You can keep the default value for the checkbox field to be "off" in the form 
bean. It will be set to "on" only if the checkbox is checked on the JSP.

Thanks,
-Kalpesh

Adam Gordon <[EMAIL PROTECTED]> wrote: I'm sure this is a coding problem (they 
usually are...) on the server-side:

I've got an html:checkbox in a form and the property is mapped/spelled 
correctly to the field/method in the bean.  The behavior I am seeing is 
that the bean property (a boolean) is not being set based on the state 
of the checkbox.

I fired up Ethereal and following the TCP stream from the POST, I can 
see the name of the property being passed (
=on) as a 
parameter on the request if the checkbox is checked, but if it is not 
checked, the parameter doesn't show up at all on the request (I'd 
expected 
=off) but this might be the reason that Struts 
can't set the property if it doesn't know the value....

Obviously, I can issue a request.getParameter(
) and if it 
returns null, set the property on the bean myself, but I had hoped 
Struts would do this for me...

Anyone run into this before or have any suggestions?  Thanks.

-- adam


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






                
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 

Reply via email to