This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes problem with nested <logic:iterate> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with nested <logic:iterate>" Watch "problem with nested <logic:iterate>" New topic
Author

problem with nested <logic:iterate>

Hd Desai
Ranch Hand

Joined: Aug 04, 2003
Posts: 65
Hi,

I have a scenario where i need to display table with n number of rows where each row will have a dropdown box.

This application is in struts 1.2 and I am not able to retrive value in <logic:iterate> and I get blank.

Here is my code snippet.Help on this would be appreciated.Thanks in advance.

<logic:iterate id="dtls" name="issCrdMaintForm" property="tmpRatingList" indexId="i">
<tr class="${tdClass}" >
<td >${dtls.id}
<html:hidden property="tmpRatingList[${i}].id" value="${dtls.id}"/>
</td>
<td >
<logic:iterate name="issCrdMaintForm" id="dtlsInner" property="snpList" indexId ="j">
<html:select property="tmpRatingList[${i}].snpList[${j}].value" >
<htmlptionsCollection name="dtlsInner" property="snpList.name" />
</html:select>
</logic:iterate>
</td>
</tr>
</logic:iterate>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61450
    
  67

"s nk", please check your private messages for an important administrative matter. Thanks.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Hd Desai
Ranch Hand

Joined: Aug 04, 2003
Posts: 65
Hi Bear,

Sorry I am new here, if you can guide me where to look for private messages, I can do the needful .

Thanks
Jaimesh M Ponkia
Greenhorn

Joined: Nov 24, 2010
Posts: 21
Hd Desai wrote:Hi Bear,

Sorry I am new here, if you can guide me where to look for private messages, I can do the needful .

Thanks


You will it on the top right side, search for "My Private Messages".

Did you verify if your collections are getting populated correctly? Try putting a notEmpty tag before iterating to check the same.
Hd Desai
Ranch Hand

Joined: Aug 04, 2003
Posts: 65
Hi,

Yes I could find PM link and changed it.

Coming to my query,second list is not empty, it has values.But I think there is some syntax problem or different way to use it

basically what i have is
ArrayList Parent
id
name
ArrayList Child

where child has objects say obj with attribute as name.

I want to display this object contained in ArrayList Child as dropdown box.

Help would be appreciated.Thanks in advance.
Jaimesh M Ponkia
Greenhorn

Joined: Nov 24, 2010
Posts: 21
There is no need to use iterator for the drop down list that you are displaying.

Something like this should work for you:


 
wood burning stoves
 
subject: problem with nested <logic:iterate>