To preselect a struts radio button"
You can make the radio button checked by declaring the attribute corresponding to radio button as String and providing the default value in FormBean.
For example,
declare and define radio button attribute in FormBean
private String gender = "female";
Now in JSP
<html:radio property="gender" value="female">Female</html:radio>
<html:radio property="gender" value="male">Male</html:radio>
since the value of property gender matches with that of attribute gender in FormBean, the radio button with value female gets checked.
No comments:
Post a Comment