How to preselect struts html:radio button
Asked Answered
E

1

8

How to preselect struts 1 html:radio button?

Thanks Maria

Eridanus answered 30/7, 2011 at 12:9 Comment(0)
U
12

You should have a value in your Form object that holds the data for your radio button. You'll need to pre-fill that in your Form before forwarding to the JSP (or default it in the Form's constructor if it will always default to that value).

Action.java

form.setRadioValue("123");

View.jsp

<html:radio property="radioValue" value="123" />  // <-- this radio will be checked
<html:radio property="radioValue" value="456" />  // <-- this radio will not be checked
Umpire answered 5/8, 2011 at 19:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.