File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes accesing value from list of string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "accesing value from list of string" Watch "accesing value from list of string" New topic
Author

accesing value from list of string

ekansh singh
Greenhorn

Joined: Mar 05, 2009
Posts: 5
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
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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:
 
jQuery in Action, 2nd edition
 
subject: accesing value from list of string