aspose file tools*
The moose likes Struts and the fly likes nested iterate-help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "nested iterate-help" Watch "nested iterate-help" New topic
Author

nested iterate-help

lee anthony
Ranch Hand

Joined: Jan 23, 2004
Posts: 35
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>
Oliver Moore
Ranch Hand

Joined: Mar 04, 2003
Posts: 44
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)


Regards,<p>Ols
 
 
subject: nested iterate-help