RE: html:checkbox tag not setting its property value in Formbean

2002-03-12 Thread Krishnan

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

RE: html:checkbox tag not setting its property value in Formbean

2002-03-12 Thread Krishnan

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

RE: html:checkbox tag not setting its property value in Formbean

2002-03-12 Thread Maturo, Larry

Hi Krishnan,

See: http://jakarta.apache.org/struts/struts-html.html#checkbox

It has the indexed attribute:
indexed Valid only inside of logic:iterate tag. If yes then name 
of the html tag will be rendered as id[34].propertyName. Number 
in brackets will be generated for every iteration and taken from 
ancestor logic:iterate tag. [RT Expr]  

so I'm not sure why you would be getting an error message.  Also,
I just added it to a checkbox in one of my jsps and it compiled
okay for me.

I would like to see all of your error output.

-- Larry

 
-Original Message-
From: Krishnan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 10:00 AM
To: Struts Users Mailing List
Subject: RE: html:checkbox tag not setting its property value in
Formbean


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

RE: html:checkbox tag not setting its property value in Formbean

2002-03-12 Thread Krishnan
, Larry [EMAIL PROTECTED]
wrote:
 Hi Krishnan,
 
 See:

http://jakarta.apache.org/struts/struts-html.html#checkbox
 
 It has the indexed attribute:
 indexed Valid only inside of logic:iterate tag. If
 yes then name 
 of the html tag will be rendered as
 id[34].propertyName. Number 
 in brackets will be generated for every iteration
 and taken from 
 ancestor logic:iterate tag. [RT Expr]  
 
 so I'm not sure why you would be getting an error
 message.  Also,
 I just added it to a checkbox in one of my jsps and
 it compiled
 okay for me.
 
 I would like to see all of your error output.
 
 -- Larry
 
  
 -Original Message-
 From: Krishnan [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, March 12, 2002 10:00 AM
 To: Struts Users Mailing List
 Subject: RE: html:checkbox tag not setting its
 property value in
 Formbean
 
 
 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
  
  
 
=== message truncated ===


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

--
To unsubscribe, e-mail

RE: html:checkbox tag not setting its property value in Formbean

2002-03-12 Thread Maturo, Larry

Hi Krishnan,

So it's not a compile error.  Hmmm!  I haven't tried
my solution, so perhaps its still legal syntax, but
no longer supported.  Any comments from the news
group on this?

I know there is a multibox tag, but it doesn't have
an indexed attribute, so I'm not sure how one would
go about using it.  For grins, would you try replacing:

html:checkbox indexed=true 
name=segmentElementRow property=selected value=true
/

with
html:multibox name=segmentElementRow property=selected value=true /

and see if it works?  If so, please let me know.

-- Larry


-Original Message-
From: Krishnan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 11:22 AM
To: Struts Users Mailing List
Subject: RE: html:checkbox tag not setting its property value in
Formbean


Hi Larry,

When I invoke my jsp page this is the exception
thrown. It is not the getter method but setter method.
I tried it with indexed=true and indexed=yes.   

Apache Tomcat/4.0.1 - HTTP Status 500 - Internal
Server Error




type Exception report

message Internal Server Error

description The server encountered an internal error
(Internal Server Error) that prevented it from
fulfilling this request.

exception 

org.apache.jasper.compiler.CompileException:
/jsp/addSegElementsToMethodForm.jsp(65,3) Unable to
find setter method for attribute: indexed
at
org.apache.jasper.compiler.TagBeginGenerator.generateSetters(TagBeginGenerat
or.java:214)
at
org.apache.jasper.compiler.TagBeginGenerator.generateServiceMethodStatements
(TagBeginGenerator.java:332)
at
org.apache.jasper.compiler.TagBeginGenerator.generate(TagBeginGenerator.java
:395)
at
org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(J
spParseEventListener.java:831)
at
org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventLi
stener.java:241)
at
org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseE
ventListener.java:197)
at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:215)
at
org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:546)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:177)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:189)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:679)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:431)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:355)
at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
va:1759)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1596)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:201)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.AccessLogValve.invoke

RE: html:checkbox tag not setting its property value in Formbean

2002-03-11 Thread Maturo, Larry

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]




RE: html:checkbox tag not setting its property value in Formbean

2002-03-08 Thread Maturo, Larry

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]