wood burning stoves 2.0*
The moose likes Struts and the fly likes How to display a collection of Strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to display a collection of Strings" Watch "How to display a collection of Strings" New topic
Author

How to display a collection of Strings

Chris Spierings
Greenhorn

Joined: Mar 29, 2001
Posts: 25
I have a list of Strings being returned in a form. These Strings reside in an arrayList passed back in the form from the action. Below is what I'm thinking of doing in the JSP to display the Strings in the list. However I can't come up with the property to reference in the bean:write line below where I've placed the ?

<logic:iterate name="form" property="arrayList" type ="java.lang.String">
<tr>
<td>
<bean:write property="?"/>
</td>
</tr>
</logic:iterate>

Any help appreciated.

Thanks
Chris Spierings
Greenhorn

Joined: Mar 29, 2001
Posts: 25
Here is what worked for me:

<logic:iterate id="testName" name="testForm" property="testList" >
<tr>
<td>
<bean:write name="testName"/>
</td>
</tr>
</logic:iterate>
Aaron Ting
Ranch Hand

Joined: Dec 13, 2005
Posts: 78
Greetings Chris,

With accordance to my knowledge over Struts, you should be getting an error as your "logic" tag must have a required attribute, which is the "id".

Therefore, what i suggest to you is using the following code,



Do check it out and reply if there are further doubts..

*Cheers*
[ December 28, 2005: Message edited by: Aaron Ting ]

If you can't convince them, confuse them!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display a collection of Strings
 
Similar Threads
How to get results from indexed fields????
Passing parameters to an Action Form
Display data using Structs Tag
Data grid
how to use hashmap in logic:iterate