Click to See Complete Forum and Search --> : Struts 2 Tag


Pankaj Kumar
11-17-2009, 11:03 PM
Hi,

This is regarding the display of List content in an ArrayList(List inside a List).
Iterator tag is used to iterate over first list say List1, which contains List2. List2 is the directly involved in setting and getting the value. Here is the sample code:
<s:iterator value="tablebean" status="status" id="tablebean">
<s:property value="Id" />
<s:property value="lName"/>
<s:property value="FName"/>
<s:property value="Email"/>
<s:property value="Initials"/>
<s:property value="CDate"/>
<s:property value="MDate"/>
</s:iterator >

Fields like Id,lName,FName...etc are hardcoded here. These values are set in List2 which is further added to List1(tablebean). Requirement is to get rid of this hardcoded values and put the name using iteartion over List2. Can anyone suggest/advice?

Thanks in advance
PKumar

JavaServlet
11-21-2009, 09:32 PM
Try and display the name property of each item (defined in the attribute of the iterator tag) that calls the the method of the your bean.

Here is a property example:

<s:property value="%{#attr.tablebean.lName}" />