• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

How to display a collection of Strings

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is what worked for me:

<logic:iterate id="testName" name="testForm" property="testList" >
<tr>
<td>
<bean:write name="testName"/>
</td>
</tr>
</logic:iterate>
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic