How to preselect struts html:radio button

孤街浪徒 提交于 2020-01-01 05:59:14

问题


How to preselect struts 1 html:radio button?

Thanks Maria


回答1:


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


来源:https://stackoverflow.com/questions/6883008/how-to-preselect-struts-htmlradio-button

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!