You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jean-Noel Ribette <je...@improve.fr> on 2002/10/16 11:37:31 UTC

Re: struts collection - layout with ArrayList returning from an bean

Hi,

If you're getting the list by the getColumn1 method, the code should be:

<jsp:useBean id="result" scope="request" 
class="com.hvbsystems.sg.marvin.obj.ResultBean" />

<layout:collection name="result" property="column1" styleClass="ARRAY" 
id="column1">
         <layout:collectionItem title="Column1" name="column1" />
</layout:collection>

struts-layout also allows to iterate over two collection, so you will be 
able to do:

<layout:collection name="result" property="column1" name2="result" 
property2="column2" styleClass="ARRAY" id="column1" id2="column2">
         <layout:collectionItem title="Column1" name="column1" />
         <layout:collectionItem title="Column2" name="column2" />
</layout:collection>
However it is not possible to iterate over more than 2 collections, and you 
may have to change your data model to display it easily without using 
scriptlet.

Regards,

Jean-Noel

At 11:16 16/10/2002, you wrote:
>hi,
>
>in my struts-webapplication i'm using an data-bean, which returns an
>ArrayList
>for every columns of an sql statement:
>
>public List getColumn1( )
>
>returns an List of String objects
>
>
>
>i'm trying to use the collection-tag to display the different columns of the
>sql statement:
>
><jsp:useBean id="result" scope="request"
>class="com.hvbsystems.sg.marvin.obj.ResultBean" />
>
><layout:collection name="result" styleClass="ARRAY" >
>
><layout:collectionItem title="Column1" property="column1" />
>
></layout:collection>
>
>
>it doesn't work ;-(
>
>the output looks like:
>
>[JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB,
>JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB,
>JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB,
>JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB, JAVAWEB]
>
>it should looks like a table:
>
>JAVAWEB
>JAVAWEB
>JAVAWEB
>JAVAWEB
>JAVAWEB
>....
>
>
>hope for help ;-)
>
>many thank's
>
>
>         Heiko Mesech
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>