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";
      }


Related posts

Delete files FAST in Linux

Magento – Get the list of products which customer wanted to be notify when it is back in stock

Common Code Error When Upgrading to PHP 8.1