struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Asif Rahman" <arah...@worlddata.com>
Subject [SOLVED] Re: Struts alternative to using request.getParameterValues in an actionform?
Date Thu, 17 Jun 2004 15:17:12 GMT
Thanks a million Atta-ur!! Indexed properties worked!  I tried using the
struts nested tagblibs first, but couldnt get it to work with that, it
seemed good only for display, but not retrieving objects into the actionform
from the jsp page when submitting.  Indexed properties definitely did the
trick.  I found the following links helpful:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg96800.html

and

http://www.sudsy.net/technology/struts-advanced.html


All I did with my code was....


JSP snippet:
  ......
 <logic:iterate id="site" name="OpportunitySitesForm" property="sitesList"
>
   <tr>
    <td colspan="2"><html:text name="site" property="siteName"
indexed="true" /></td>

     .......

ActionForm snippet:

public SitesDTO getSite(int index) {

return (SitesDTO) sitesList.get(index);

}


public void setSite(int index, SitesDTO site) {

this.sitesList.add(index,site);

}


where "site" in the logic:iterate has a matching "site" SiteDTO object in
the actionform.

-Asif



----- Original Message ----- 
From: "atta-ur rehman" <attar@numetrics.com>
To: "Struts Users Mailing List" <user@struts.apache.org>; "Asif Rahman"
<arahman@worlddata.com>
Sent: Tuesday, June 15, 2004 5:14 PM
Subject: Re: Struts alternative to using request.getParameterValues in an
actionform?


> Hellow Asif,
>
> "Indexed Properties" is exactly what you need here. For more info, please
> search thru the mail archive at:
>
> http://www.mail-archive.com/user@struts.apache.org/
>
> or at:
>
>
> ----- Original Message ----- 
> From: "Asif Rahman" <arahman@worlddata.com>
> To: <user@struts.apache.org>
> Sent: Tuesday, June 15, 2004 2:00 PM
> Subject: Struts alternative to using request.getParameterValues in an
> actionform?
>
>
> 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