Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to preselect struts html:radio button

Tags:

struts-1

How to preselect struts 1 html:radio button?

Thanks Maria

like image 622
Maria Avatar asked Jul 30 '11 12:07

Maria


1 Answers

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
like image 105
Joseph Erickson Avatar answered Sep 19 '22 18:09

Joseph Erickson