I need to set checkbox by default .I search net and some people give advice to set set the value true in reset method but the problem with it is that when user uncheck the checkbox then too i receive the value true . Thanks
Checkboxes in Struts 1 are a pain because they don't get passed through the request when they are not checked, so you have to make special allowances to uncheck them. Therefore, I use radio buttons whenever possible. However, sometimes I need a checkbox, so what I usually do is set the default value in my action class before loading the page (or sometimes directly in the form, as in 'String myCB = "true"'), then have a hidden input in my jsp as follows:
What I normally do is set the property to true in the action class that forwards to the JSP if I want it checkec by default, and then I set it to false in the reset() method of the ActionForm bean. That way if the user unchecks it, it will get cleared properly.