• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accesing value from list of string

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello all
I am new to struts 2.
I am having List of string in action classs
List<String> categories

this class has getter and setters

now there is a guide.jsp

<s:iterator value="categories">

<tr>
<td>

<s:url id="categoryInformation" action="ShowCategoryInformation.action">
<s:param name="categoryName" value ="" />
</s:url>
<s:a href="%{categoryInformation}">
<s:property/>
</s:a>
</td>

</tr>
</s:iterator>

i know how to display the value stored in the list .. i mean i can use this <s:property/>
but here I want to make the url

<s:url id="categoryInformation" action="ShowCategoryInformation.action">
<s:param name="categoryName" value ="" />
</s:url>

and this VALUE in <s:param name="categoryName" value ="" /> >

should be the the string present in th list..
can you please tell me how to get each string value from the list the value attribute of Param tag
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the iterator tag's "id" (S2.0) or "var" (S2.1) attribute to hold each object of iteration then refer to it in the param tag:
 
reply
    Bookmark Topic Watch Topic
  • New Topic