Making a Struts Radio selected

By default, struts’s html radio tag do not allow you to make a radio to be selected as they have no “selected” property or something

<html:radio property="gender" value="F" />Male
<html:radio property="gender" value="M"/>Female

To make a radio button to be selected on load, set the value that you want to be selected in your action form reset method


public void reset(ActionMapping mapping, HttpServletRequest request) {
            super.reset(mapping, request);
            gender= "F";
      }

Similar Posts:

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
Making a Struts Radio selected, 10.0 out of 10 based on 1 rating