Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to iterate over an array list of beans in a JSP using struts2 tags

Tags:

java

jsp

struts2

My JSP receives an ArrayList of beans from a Struts2 action.

I want to iterate over them and print every bean and its properties per line.

How can I do this using Struts2 tags?

like image 488
Anand Avatar asked Jan 23 '23 13:01

Anand


1 Answers

Use <s:iterator> tag.

<s:iterator value="beans">
     <p>Property foo: <s:property name="foo" /></p>
     <p>Property bar: <s:property name="bar" /></p>
</s:iterator>

An overview of all tags can be found in their own documentation: tag reference. Bookmark it.

like image 103
BalusC Avatar answered Jan 25 '23 02:01

BalusC