hi
I have a checkbox in a JSP in struts environment:
<html:checkbox property="conversionOption"/>
now in struts-config, the dynaactionform is :
<form-bean name="QuoteDetailsBean" type="org.apache.struts.validator.DynaValidatorActionForm">
...................
<form-property name="conversionOption" type="java.lang.String"/>
..........................
</form-bean>
now if the checkbox is not clicked, and in the action class I do:
String s = (String)formbean.get("conversionOption");
s is null.
Now when i check(select) the check box, and click on submit the String s is 'on'. After this if I click on 'back' button and then uncheck the checkbox and click submit., the String is still 'on'. I expect it to be null or something other than 'on'.
It seems struts does not set conversionOption property if the checkbox for that property is not selected. so the previous value remains.
how do I overcome this?
I tried by changing :
<form-property name="conversionOption" type="java.lang.String"/>
to
<form-property name="conversionOption" type="java.lang.
String[]"/>
but it did not help. changing to String[] will help if i have musltiple checkboxes for the same property. but my form has only one checkbox.
can anybody please help me?
Tanveer