html:radio 标记中怎么样指定一个初始值(默认值)?

  <tr> 

  <td width="100%" align="center">

    <input type="radio" name="visibility" value="0" checked="checked">公开目标  

    <input type="radio" name="visibility" value="1">私人目标</td>

    <!--

     <html:radio property="visibility" value="0"/>公开目标  

     <html:radio property="visibility" value="1"/>私人目标</td>

    -->

 </tr>

如上,怎么样在struts中的html:radio 标签中达到html 中<input type="radio" name=... checked="checked"...的效果?

2 thoughts on “html:radio 标记中怎么样指定一个初始值(默认值)?”

  1. 如果是这样,不知行不行:

    <html:radio property="radio0" value="0"/>

    <html:radio property="radio1" value="1"/>

    即,property属性是不同的,

    这样,如果formbean中的radia0的值是0,第一个radio就被选中了,

    如果radio1是1,则第二个radio就被选中了。

    当然,不知道这种方法是否满足老兄的需求。

  2. 公开目标

    私人目标

    设置默认值的方法
    在这个页面相对应的form中的reset()方法中这样设置
    this.visibility="0"
    这样公开目标就是默认选项了

Comments are closed.