Hi Larry,

Thanks for your suggestion.  I downloaded the nightly
build for struts (dated 3/11/02) and installed it in
my Tomcat 4.0.1 environment.  In My Jsp I have the
following logic:iterate tag

<logic:iterate id="segmentElementRow"
type="com.xxx.ui.action.SegmentElementSelectRow"
name="addSegElementsToMethodForm"
property="segElementSelections" >
 <tr>
   <td align="center">
        <html:checkbox indexed="true" 
name="segmentElementRow" property="selected"
value="true"  />
                </td>
                <td align="center">
                        <bean:write name="segmentElementRow"
property="elementNbr" />
                </td>
                <td align="center">
                        <bean:write name="segmentElementRow"
property="elementName" />
                </td>
                <td align="center">
                        <bean:write name="segmentElementRow"
property="baseTable" />
                </td>
        </tr>
        </logic:iterate>

At loading the jsp compiler is complaining about no
getter method available for property indexed!.  Also,
the struts documentation for html:checkbox tag does
not talk about an attribute indexed for html:checkbox.
 Is this the right syntax ?.  

Krishnan
--- "Maturo, Larry" <[EMAIL PROTECTED]>
wrote:
> Hi Krishnan,
> 
> If you are using a nightly build you can probably
> use
> the indexed attribute.  This would look something
> like this:
> 
> In your jsp:
> <logic:iterate id="fruits" name="nameOfYourFormBean"
> property="fruits">
>       <html:checkbox indexed="true" name="fruits"
> property="checked"/>
>       <bean:write name="fruits" property="fruitName" />
> </logic:iterate>
> 
> in class Fruit
> public class Fruit {
>       private String fruitName = "";
>       private boolean checked = false;
>       
>       public Fruit() {
>         super();
>       }
>       
>       public String getFruitName() {
>               return fruitName;
>       }
> 
>       public void setFruitName(String _fruitName) {
>               fruitName = _fruitName;
>       }
> 
>       public boolean getChecked() {
>               return checked;
>       }
> 
>       public void setChecked(boolean _checked){
>               checked = _checked;
>       }
> }
> 
> In you form bean:
> 
> private ArrayList frutis = null;
> 
> public ArrayList getFruits() {
>       return fruits;
> }
> 
> public void setFruits(ArrayList _frutis) {
>       fruits = _fruits;
> }
> 
> public Fruit getFruits(int index) {
>       return (Fruit) fruits.get(index);
> }
> 
> public void setFruits(int index, Fruit fruit) {
>       fruits.set(index,fruit);
> }
> 
> public void reset(ActionMapping mapping,
>                
> javax.servlet.http.HttpServletRequest request){
>       Fruit f = null;
>       Iterator it = fruits.iterator();
>       while it.hasNext() {
>         f = (Fruit) it.next();
>         f.setChecked(false);
>       }
> }
> 
> In your action class you would then create an array
> list of
> fruits and set them in your form bean.  After the
> form was
> submitted you would get the list back out and see
> which
> fruits were checked.
> 
> The trick to make this work is that the id used with
> the iterate
> tag can not be random, it must exactly match the
> property in
> your form bean that you want to get set.
> 
> I hope this helps.
> 
> -- Larry Maturo
>    [EMAIL PROTECTED]
> 
> 
> -----Original Message-----
> From: KrishPS [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, March 09, 2002 8:33 AM
> To: Struts Users Mailing List
> Subject: Re: html:checkbox tag not setting its
> property value in
> Formbean
> 
> 
> Hi Larry
> 
> Each element in the array list is a bean and the
> bean has a boolean property
> for the checkbox.
> 
> Krishnan
> [EMAIL PROTECTED]
> 
> ----- Original Message -----
> From: Maturo, Larry <[EMAIL PROTECTED]>
> Newsgroups: Struts
> To: 'Struts Users Mailing List'
> <[EMAIL PROTECTED]>
> Sent: Friday, March 08, 2002 5:13 PM
> Subject: RE: html:checkbox tag not setting its
> property value in Formbean
> 
> 
> > Hi Krishnan,
> >
> > Could you post more details.  Is the arraylist an
> > arraylist of boolean, or an arraylist of some
> > bean, which itself has a boolean property, or
> > perhaps each entry in the arraylist is of a
> > different type?
> >
> > -- Larry Maturo
> >    [EMAIL PROTECTED]
> >
> >
> > -----Original Message-----
> > From: Krishnan [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, March 08, 2002 3:19 PM
> > To: [EMAIL PROTECTED]
> > Subject: html:checkbox tag not setting its
> property value in Formbean
> >
> >
> > Hi
> >
> >  In my Jsp form,  I have a check box that is part
> of a
> > collection object.  This collection object is
> rendered
> > through a bean. The collection (arrayList) itself
> has
> > getter/setter in the form bean. When I select the
> > checkbox on the form, the corresponding property
> value
> > is not updated to true.  However, I saw that the
> > request parameters had the property name for the
> > checkbox with the value 'true'.  Are there other
> ways
> > of getting the checkbox to set the property?.  Any
> > examples would be appreciated.
> >
> > Thanks
> >
> > Krishnan
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Try FREE Yahoo! Mail - the world's greatest free
> email!
> > http://mail.yahoo.com/
> >
> > --
> > To unsubscribe, e-mail:
> >
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to