struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Asif Rahman" <arah...@worlddata.com>
Subject Re: Struts alternative to using request.getParameterValues in an actionform?
Date Wed, 16 Jun 2004 13:50:50 GMT
I tried this, it should work theoretically, but my form is empty now, none
of the textfields are showing up.  I do have a property called sitesList in
the OpporutnitySitesForm and it is already populated when I arrive at this
page.  Please advise.  Thanks.

-Asif

----- Original Message ----- 
From: "Satish Kataria" <skataria@sapient.com>
To: "Struts Users Mailing List" <user@struts.apache.org>; "Asif Rahman"
<arahman@worlddata.com>
Sent: Wednesday, June 16, 2004 8:35 AM
Subject: RE: Struts alternative to using request.getParameterValues in an
actionform?


You can use nested tags to automatically retrive and populate
information.

A snippet of code is as follows
      <nested:root name="OpportunitySitesForm">
      <nested:nest property="sitesList">
    <logic:iterate id="myCollectionElement" name="OpportunitySitesForm"
property="sitesList" >
     <nested:text name="myCollectionElement" property="siteName"/>
    </logic:iterate >
      </nested:nest property="sitesList">
      </nested:root name="OpportunitySitesForm">

It assumes you have a attribute named sitesList in ur action form

This way you can access any type of attribute from ur action form
-----Original Message-----
From: Asif Rahman [mailto:arahman@worlddata.com]
Sent: Wednesday, June 16, 2004 2:31 AM
To: user@struts.apache.org
Subject: Struts alternative to using request.getParameterValues in an
actionform?
Importance: High


Hi Im using <logic:iterate> shown below to iterate through an arraylist
(sitesList) in my actionform (OpportunitySitesForm).  This arraylist
contains a number of Site objects which have the properties siteName,
address1, and city.  This is getting displayed correctly.  Now when
processing the form, I am wondering whether in struts there is a way to
retrieve these as objects and automatically populate
setSitesList(ArrayList) method, rather than manually use
request.getParameterValues for siteName, address1, city, create
individual Site objects, add the site objects to an arraylist  with Site
objects and finally pass the list into setSitesList(arraylist).

    <logic:iterate id="myCollectionElement" name="OpportunitySitesForm"
property="sitesList" >
      <tr>
        <td colspan="2"><input type="text" name="siteName"
value='<bean:write name="myCollectionElement" property="siteName"
/>'></td>
        <td colspan="2"><input type="text" name="address1"
value='<bean:write name="myCollectionElement" property="address1"
/>'></td>
        <td colspan="2"><input type="text" name="city"
value='<bean:write name="myCollectionElement" property="city" />'></td>
      <tr>
    </logic:iterate>

Any help would be most appreciated.  Thanks!

-Asif

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message