[opencms-dev] Iterate thorugh ArrayList in OpenCms

Andrew Reid andrew.reid at plug.cx
Mon Apr 25 07:57:37 CEST 2005


On 21/04/2005, at 7:37 PM, visser arthur (02VOEMDIAHTKAND) wrote:

> Can anyone tell me how to write a short piece of code to get an 
> ArrayList (Results) from a java bean into the jsp page and iterate 
> through its content?
> I can call the Array by using using the usebean command followed by:
> <jsp:getProperty name="gebruik" property="results"/>,
> but I only get the last value from the Array (which is build in a 
> separate java bean and returned)
> What is the code to use this ArrayList in my jsp and iterate through 
> its results?
> Your help is much appreciated!

Have a look at the JSTL Core tag library. In your case, you'd probably 
do something like:

<c:forEach var="widget" items="${results}" begin="0">
   <p>Widget Name: ${widget.name}</p>
   <p>Widget Cost: ${widget.cost}</p>
</c:forEach>

    - andrew

--
| Andrew Reid [andrew.reid at plug.cx]
| Overworked and Underpaid Network Monkey
| C: +61-401-946-813  F: +61-8-8338-2518





More information about the opencms-dev mailing list