struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adolfo Miguelez" <>
Subject Re: referencing bean properties in jsps
Date Fri, 16 Aug 2002 11:57:59 GMT

Community prefers ArrayList rather than Vectors since ArrayList methods are 
not synchronized and Vector methods do. Depends on your necessities but 
mostly ArrayList are enough for read only data.

IF you have an ArrayList of beans in your action, you can send it to your 
JSP by:

request.setAttribute("DataList", your_array_list);


request.getSession(false).setAttribute("DataList", your_array_list);

and after do the mapping in the Action by:

return mapping.findForward("your_JSP");

In the JSP you can sweep your collection with a logic:iterate tag as:

<logic:iterate name="DataList" id="RowData">

      <bean:write name="RowData" property="a_property_of_your_bean"/>



With <bean:write> you get the value of properties for each bean, which is 
defined as a local variable inside the logic:iterate (each bean in the 
collection is called RowData in this example).

Hope it helps,


>From: "Fabian Sommer" <>
>Reply-To: "Struts Users Mailing List" <>
>To: <>
>Subject: referencing bean properties in jsps
>Date: Fri, 16 Aug 2002 13:44:23 +0200
>Hi folks!
>I got problem, I don't really know if it's due to misunderstanding jee
>or anything else.
>I got a data-storage-bean, where I've put some data by adding little
>java beans to a vector and presenting this vector to that bean.
>Now I want to retrieve that vector from that bean to fill some table
>rows in a jsp.
>How do get that?
>I try to use the same bean for storing some form data on the same jsp.
>Here some code I use: (I use strutsh as prefix for struts-html.tld)
><table border="0">
><strutsh:form action="/" method="POST">
><th align="center">ID</th>
><th align="center">Name</th>
><th align="center">Short</th>
>HERE I want to put some data rows filled up with data stored in the
>raw-Vector. It's the same form-bean as used in this little code-package.
>	Vector raw = RawMat_Tab.getRawVector();   <-- the getter-method
>of my
>bean for that vector
><td><strutsh:text property="rawname" size="16" maxlength="18"/></td>
><td><strutsh:text property="rawshort" size="4" maxlength="4"/></td>
><td><strutsh:submit /></td>
>Any Ideas? Or is it not jee-compliant to use a vector to store data in a
>Any help or comment would be fine. Thx!
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 

             <TITLE>Adolfo's signature</TITLE>
             <center><b><em>Adolfo Rodriguez Miguelez</em><b></center>


Send and receive Hotmail on your mobile device:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message