The
value attribute for an <html:checkbox> is a little different than other controls. It indicates the value that will be passed to the server when the box is checked. It does
not indicate whether the box will initially be displayed as checked or not.
Since the <html:checkbox> is tied to the value of the ActionForm property you specify, the way to indicate that the box is to be displayed as checked is to set the ActionForm property it is tied to as "true" prior to the page being displayed. Example:
in your Action form:
private boolean myCheckbox;
public boolean isMyCheckBox() { return myCheckbox; }
public void setMyCheckBox(checkboxValue) { myCheckbox = checkBoxValue; }
In the Action that forwards to the
JSP myForm.setCheckBox(true);
In your JSP:
<html:checkBox property="myCheckBox" />
This will cause the checkbox to show as checked when the page is displayed.