A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
setting checkbox value
Joined: May 09, 2005
Aug 15, 2005 09:31:00
In my struts-config.xml I have:
<form-property name="chkbox1" type="java.lang.Boolean"/>
anActionForm.java extends DynaValidator form. And in the reset( ) method I am trying to set the checkbox value to false by the following:
However when I compile I get the following error:
"Cannot resolve symbol: method set(
Can anyone see why the set method (inherited from the
ActionForm class) will not accept a boolean value?
Joined: Apr 14, 2005
Aug 15, 2005 09:41:00
it simply won't since the set/get doesn't do type coercion. you'll need to have the checkbox values set to a
('Y' for example), then convert that to a boolean primitive.
-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Joined: Aug 05, 2004
Sep 13, 2005 14:41:00
It will expect Boolean object rather than boolean value.
use set("name", Boolean.valueOf(false)) rather than using set("name", false).
I agree. Here's the link:
subject: setting checkbox value
Still not working - DynaValidatorActionForm and checkboxes
check box with html:checkbox
Checking Checkbox values in indexed form
struts2 - spring - freemarker - message property key not working for validation
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014