Hi, i am currently reading up on delegating as much processing as possible to
javabeans components hence i have come across various beans regarding html forms
ie <html:select,html:option, logic:iterate etc etc . Pls could anyone explain or
advise were one can get an understanding on selection to the desired form bean.
Cheers chuck

Gregor Rayman wrote:

> The problem is, the generated names of the HTML form elements do not
> correspond to the names of properties of your ActionForm.
>
> Here a sample, how this can be done:
>
>   <logic:iterate name="myForm" property="elements" id="element" indexId="i"
>      type="de.grayman.test.struts.MyElement">
>     <tr>
>       <td>
>         <html:checkbox property='<%= "element[" + i + "].member" %>'  />
>         <html:hidden property='<%= "element[" + i + "].elementName" %>'  />
>       </td>
>       <td><bean:write name="element" property="elementName" /></td>
>       <td><bean:write name="element" property="elementDescription" /></td>
>     </tr>
>   </logic:iterate>
>
> In the MyForm class, there have to be two properties (getter methods):
>
> 1) the collection "elements"
> 2) indexed property "element"
>
> private Vector elements;
>
> public Collection getElements() {
>     return this.elements;
> }
>
> public MyElement getElement(int i) {
>    while (getGroups().size() <= i) {
>        this.element.add(new MyElement());
>    }
>    return (MyElement) this.elements.get(i);
> }
>
> Note: Class MyElement has read/write properties member, elementName,
> elementDescription, ...
>
> Note: The getElement(int i) fills the Vector with empty elements, if they do
> not exist.
> In this way, the form will be filled correcly from the submitted HTML-Form. Of
> course,
> you could use another approach, e.h. HashTable or an Array instead of Vector.
>
> --
> gR
>
> ----- Original Message -----
> From: "Vaibhav Patil" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 09, 2001 2:02 PM
> Subject: Iterate tag update
>
> > Hi,
> >     I am using logic:iterate tag as follows to print a table with text
> > boxes.
> >
> >         <logic:iterate id="product" name="productSearchForm"
> > property="productList">
> >         <tr>
> >           <td align="left">
> >             <bean:write name="product" property="productNumber"
> > filter="true"/>
> >           </td>
> >           <td align="center">
> >             <html:text name="product" property="quantity" size="3"/>
> >           </td>
> >         </tr>
> >         </logic:iterate>
> >
> > I have a array of objets(Product) in productList. When I update the quantity
> > and submit the page, it does not update the information into the
> > productList.
> >     What might be the problem???
> >
> > Vaibhav
> >

--
The views expressed by the sender of this message don't
necessarily represent those of Brecon Beacons National Park
Authority. This message is intended for the addressee(s) only
and is sent in confidence; if you receive it in error, please can you
let us know (at [EMAIL PROTECTED]) and then destroy all copies.
Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn
adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog.
Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion
yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn
mewn camgymeriad, a fyddech gystal â rhoi gwybod i
ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.


Reply via email to