大家好! 
    
    <bean:write name="CompeteList" property="competeId"/></td>
    我想让这条语句用单选按钮显示给用户。。
   我试了试<html:radioname="CompeteList"property="liansaiId"value="<html:radioproperty=""value=""></html:radio>"></html:radio> 可是不行请教给位应该怎么写呢? 以下是我要输出的语句 第一条要输出的语句就是单选按钮<logic:iterate id="CompeteList" name="CompeteList">
    
      <tr> 
        <td width="6%" bgcolor="#DCDDDF"><bean:write name="CompeteList" property="competeId"/></td>
        <td width="20%" bgcolor="#DCDDDF"><bean:write name="CompeteList" property="competeName"/></td>
        <td width="6%" bgcolor="#DCDDDF"><bean:write name="CompeteList" property="competeType"/></td>
        <td width="6%" bgcolor="#DCDDDF"><bean:write name="CompeteList" property="beginTime"/></td>
        <td width="6%" bgcolor="#DCDDDF"><bean:write name="CompeteList" property="endTime"/></td>
        </tr>
  </logic:iterate>
 

解决方案 »

  1.   

    <html:radio name="CompeteList" property="liansaiId"> 
       <html:radioproperty=""value=""> </html:radio>
    </html:radio>
      

  2.   

    <logic:iterate id="CompeteList" name="CompeteList">
          <tr>
            <td width="6%" bgcolor="#DCDDDF"> 
            <html:radio idName="CompeteList" property="competeId" value="competeId">
                    <bean:write name="CompeteList" property="competeId"/> 
            </html:radio> 
    </td>
            <td width="20%" bgcolor="#DCDDDF"> <bean:write name="CompeteList" property="competeName"/> </td>
            <td width="6%" bgcolor="#DCDDDF"> <bean:write name="CompeteList" property="competeType"/> </td>
            <td width="6%" bgcolor="#DCDDDF"> <bean:write name="CompeteList" property="beginTime"/> </td>
            <td width="6%" bgcolor="#DCDDDF"> <bean:write name="CompeteList" property="endTime"/> </td>
            </tr>
      </logic:iterate> 
      

  3.   

    试了试 还是不行
    报错信息为 Cannot find bean under name org.apache.struts.taglib.html.BEAN
      

  4.   

     Cannot find bean under name org.apache.struts.taglib.html.BEAN 
    引入标签
      

  5.   

    这个当然引入了~~  <html:radio name="CompeteList" property="competeId" value="<bean:write name='CompeteList' 
               property='competeId'/> " onclick="alert(this.value)" >     
     </html:radio>我要是这样写的话 他不识别<bean>标签 当字符串处理了  怎么解决呢
      

  6.   

    html标签不能这么写
    按照我给你的方法,如果出现错误,请确认你的form用的是<html:form
      

  7.   

    你的方法我试了~~ 报错了~ 是用的<html:form<html:radio idName="CompeteList" property="competeId" value="competeId">如果把上句话里的idName换成 name就没错了 可是bean标签的内容跑到单选按钮的旁边了 单选按钮就没有值了顺便问问 idName 是什么意思呢
      

  8.   

    struts根据idName来生成html的radio标签<html:radio idName="CompeteList" name="CompeteList" property="competeId" value="competeId"> 这样selected和value都会生成
      

  9.   

    可是 还是报错啊  报错信息为 Cannot find bean under name org.apache.struts.taglib.html.BEAN 是什么问题呢
      

  10.   

    还有问题?
    idName就是你的集合里面的类,声明了这个之后property="competeId" 中的competeId的值如果和value="competeId"中的值一致的话,就生成checked="checked"<html:radio idName="CompeteList" name="CompeteList" property="competeId" value="competeId">
    还有错的话,就不应该是这里的问题,这个问题网上的提示有很多贴出你的完整代码吧
      

  11.   

    问题终于解决了!!首先非常感谢Landor2004的热心帮助 虽然提出的答案最终没有弄明白 但极开发了我的思考本人解决问题的代码如下:   <html:radio name="CompeteList" property="competeId"  
             value="${CompeteList.competeId}">            
       </html:radio>一直钻牛角尖了,用上ER表达式问题就很好解决了
      

  12.   

    Landor2004说的方法明明可以呢,Struts标签说明是那样的嘛。
    idName 
    Since: Struts 1.1Name of the bean (in some scope) that will return the value of the radio tag. Usually exposed by an iterator. When the idName attribute is present, the value attribute is used as the name of the property on the idName bean that will return the value of the radio tag for this iteration.(RT EXPR)当idName值被指定后,radio会从bean里面搜寻是否有名为idName值的bean,至于取值,就是后面的value,此时会被当成bean里面的一个属性,不指定后面的值只当普通字符串处理。
      

  13.   

    logic标签不可以嵌套stuts标签,你把单选按钮换成html标签就可以了
      

  14.   

    Cannot find bean under name org.apache.struts.taglib.html.BEAN 楼主遇到的这个问题与Landor2004给出代码没有关系,是标签的书写问题。
    可能是你在这段代码之前写了类似<bean:write />的代码,如果写成<bean:write></bean:write>应该就没有问题了。