1、默认选中效果

  在后台XxxForm中写入如下代码,可保证默认选中效果实现:

@Override
public void reset(ActionMapping mapping, HttpServletRequest request) {
ve.setBuytaxisf("是");//是否免税交纳属性默认选中效果
super.reset(mapping, request);
}

  jsp代码:

<html:radio property="ve.buytaxisf" value="是"></html:radio>
<html:radio property="ve.buytaxisf" value="否"></html:radio>

 

  页面效果:struts1标签-<html:radio> 使用注意事项

  好处:1、不用设置默认值;2、页面选中效果自动实现。

  缺点:在action中接收并使用(XxxForm)xxxForm进行查询时,需将设置默认值的属性set为null,否则在查询条件(xxxForm对象)中包含默认值

2、禁用效果

<html:radio property="ve.buytaxisf" value="" style="display: none"></html:radio>
<html:radio property="ve.buytaxisf" value="是" disabled="true"></html:radio>
<html:radio property="ve.buytaxisf" value="否" disabled="true"></html:radio>

 

  页面效果:struts1标签-<html:radio> 使用注意事项

  注:测试发现,当把所有radio都设置成disabled,总会把第一个默认为可选,所以可以采用如上方法实现禁用效果

相关文章:

  • 2021-11-20
  • 2018-04-03
  • 2021-06-03
  • 2022-12-23
  • 2021-10-10
  • 2021-05-21
  • 2021-12-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2021-10-06
  • 2021-12-31
  • 2021-10-31
  • 2021-08-16
相关资源
相似解决方案