如何预选Struts html:单选按钮 [英] How to preselect struts html:radio button

查看:120
本文介绍了如何预选Struts html:单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何预先选择struts 1 html:radio按钮?

How to preselect struts 1 html:radio button?

谢谢 玛丽亚

推荐答案

您应该在Form对象中具有一个值,该值包含单选按钮的数据.在转发到JSP之前,您需要在Form中预先填充它(或者如果它始终默认为Form的值,则在Form的构造函数中将其默认).

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

这篇关于如何预选Struts html:单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆