Struts的html:radio标签中不能用checked="checked",要改为:
<html:radio property="test" value="0"/>A
<html:radio property="test" value="1"/>B
<html:radio property="test" value="2"/>C在bean中(ActionForm),设置test的初值:
 private String test="2";
......
        public String getTest()
        {
            return (this.test);
        }        public void setTest(String test)
        {
            this.test=test;
        }
-----------------
运行结果是选中了C。同样,如果初值test="2",则选中B。-------------
我在JSPStudio中试运行过,这样改后一切正常。

解决方案 »

  1.   

    actionform
    Vector shippers = new Vector();
    shippers.add(new LabelValueBean("A", "0")); 
    shippers.add(new LabelValueBean("B", "1")); 
    shippers.add(new LabelValueBean("C", "2")); 
    request.setAttribute ("SHIPPERS",shippers);jsp页面
    <logic:iterate id="row" name="SHIPPERS"> 
    <html:radio property="test" value="value" idName="row"/> 
    <bean:write name="row" property="label"/>
    </logic:iterate>
    已经显示出来,但是如何选中默认的radio 还要请教各位
      

  2.   

    直接用Checked不行么?或者checked="true"