Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

nested iterate-help

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
friends can any body tell me how do i iterate my category table with id, name,description fields
simultaneously iterate the inner table idea iterate with with catid, name,description fields
view should be with respect to categories id
that is ideas table should be display for each catid it should
id of category = catid of idea
i was trying to do some rnd but it is not working to my expectation

<logic:iterate id="category" name="categories">
<tr>
<td style="vertical-align: top;" bgcolor="#CBDAE5">
<bean:write name="category" property="id"/>
</td>
<td style="vertical-align: top;" bgcolor="#CBDAE5">
<bean:write name="category" property="name"/>
</td>
<td style="vertical-align: top;" bgcolor="#CBDAE5">
<bean:write name="category" property="description"/>
</td>
<td style="vertical-align: top;" bgcolor="#CBDAE5">
<html:link page="/Welcome.do">
<bean:message key="category.linkedit"/>
</html:link>
<a href="DeleteCategoryAction.do?action=delete&id=<bean:write name='category' property='id'/>"><bean:message key="category.linkdelete"/></a>
</td>
</tr>
<%-- Just rnd remove it later --%>
<logic:iterate id="idea" name="ideas" >
<tr>
<td style="vertical-align: top;" bgcolor="#CBDAE5">
<bean:write name="idea" property="id"/>
</td>
<td style="vertical-align: top;" bgcolor="#CBDAE5">
<bean:write name="idea" property="name"/>
</td>
<td style="vertical-align: top;" bgcolor="#CBDAE5">
<bean:write name="idea" property="description"/>
</td>
<td style="vertical-align: top;" bgcolor="#CBDAE5">
<html:link page="/Welcome.do">
<bean:message key="category.linkedit"/>
</html:link>
<a href="DeleteCategoryAction.do?action=delete&id=<bean:write name='category' property='id'/>">idealink</a>
</td>
</tr>
</logic:iterate>
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lee...
Something like this perhaps? Will need some tweaking though...
<% String catCatId; %>
<logic:iterate id="category" name="categories">
<% catCatId = category.getId(); %>
Place rest for <bean:write > and HTML here for category
<logic:iterate id="idea" name="ideas" >
<% if (catCatID.equals(idea.getCatId())) { %>
Place rest for <bean:write > and HTML here for idea
<% } %>
</logic:literate>
</logic:literate>
You might be able to simplfy this futher with <logic:equal> tags...
Hope this is of some help (and correct :S)
 
reply
    Bookmark Topic Watch Topic
  • New Topic