[opencms-dev] JavaBean with ArrayList in openCMS

Xavier Ottolini xavier.ottolini at adelis.com
Fri Apr 22 13:55:51 CEST 2005


Hi Arthur,

Try This

<%
ArrayList weightList = gebruik.getResults();

Iterator it = weightList.iterator();

while (it.hasNext()) {

}

%>


I hope that it helps

Xavier Ottolini
Développeur multimédia

Arthur Visser a écrit :

> I have made an application in OpenCms using a JavaBean.
>
> In principle the Bean works fine and I can pass variables between the 
> bean and my jsp using setProperty and getProperty commands.
>
> However, I now expanded the bean with an ArrayList :
>
> Public ArrayList getResults() {
>
> …..
>
> ….
>
> Return Results;
>
> }
>
> The Arraylist is filled with variables via a JDBC connection, but this 
> seems to be working fine.
>
> The problem I now have is that I do not succeed to get the full 
> ArrayList into my jsp to read the values.
>
> I tried various ways, one of which is partly copied below :
>
> <jsp:useBean id="gebruik"
>
> class="com.opencms.beans.MyWeight" scope="session">
>
> <jsp:setProperty name="gebruik" property="*" />
>
> <jsp:setProperty name="gebruik" property="lidid" value="<%= lidid %>" />
>
> </jsp:useBean>
>
> <br>Aantal:<jsp:getProperty name="gebruik" property="rowCount"/>
>
> <table><tr>
>
> <%
>
> weightList =%><jsp:getProperty name="gebruik" property="results"/><%;
>
> Iterator it = weightList.iterator();
>
> while (it.hasNext()) {
>
> }
>
> %>
>
> </tr></table>
>
> ‘rowCount’ is displayed , no problem.
>
> I do not succeed to get my ArrayList ‘results’ and iterate through it. 
> Anybody has a suggestion or a piece of code that works?
>
> Thanks!
>
> Arthur Visser
>
>------------------------------------------------------------------------
>
>
>
>_______________________________________________
>This mail is send to you from the opencms-dev mailing list
>To change your list options, or to unsubscribe from the list, please visit
>http://mail.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list