Do you really have to go through all that? Why not just get rid of the 'value' attribute in the checkbox tag? It seems completely unnecessary. Just send a boolean to the setIsBillable() method and you should be set.
~ Keith -----Original Message----- From: Abhishek Goel [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 12:39 PM To: Struts Users Mailing List Subject: Re: html:checkbox tag does not set the checked value Hi, i think the value "chkVal" in the <html:checkbox .....>tag is the value that will be submitted when you check the box. so the property attribute isBillable will be given the value "chkVal" when you check this value. Insideform this property will definitely of boolean data type. now you will assign the value true or false in your frorm class by checking against the value that has been assigned to this variable "isBillable". i.e public void setIsBillable(String billable) { if(billable.equals("chkVal")==true) { isBillable=true;// else assign to false which is anyway done in default } } i hope this will help. Regards Abhishek Goel Toni Nehme wrote: > Hi, > > I have a class and an action and a form, > I am trying to check one of the two checkboxes and submit and > display the selected checkbox value. > > The following code is in my form: > > public final class TestForm extends ActionForm { > > private String chkVal = "on"; > private boolean isBillable = false; > > public String getChkVal() > { > return (this.chkVal); > } > > public void setChkVal(String _chkVal) > { > this.chkVal = _chkVal; > } > > public boolean getIsBillable() > { > return isBillable; > } > > public void setIsBillable(boolean billed) > { > isBillable = billed; > } > > public void reset(ActionMapping mapping, HttpServletRequest request) > { > isBillable=false; > } > } > > The test.jsp has the following code: > > <html:html> > <head> > <title> > <bean:message key="welcome.title"/> > </title> > <html:base/> > </head> > <body> > <html:errors/> > <html:form action="/test"> > <html:checkbox property="isBillable" value="chkVal"/> > <html:submit> > <bean:message key="button.display"/> > </html:submit> > </html:form> > </body> > </html:html> > > When I click on the button to submit the form, I tried to display the > attributes of the checkbox and they are still > isBillable=false > value="on" > > Does anybody know how to fix? > Or anybody knows a detailed html:checkbox with struts detailed example > to point me to it? > > Thanks,,, > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. > > -- > 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]>