<html:select property="type">           
   <logic:iterate id="item" name="allType" type="TypeDB">
       <html:option  value="<bean:write name='item' property='type'/>"/>
    </logic:iterate>            
</html:select><html:errors property="type"/>

解决方案 »

  1.   

    to  caiyi0903(willpower): option这个tag好像是不支持嵌套的,你这个方法我试过,还是不行的!
    还有其它方法嘛?
      

  2.   

    要我说,能用Tag最好,但也不是一定得都用tag,我总感觉这些东西也不怎么方便,掌握起来又花时间
      

  3.   

    to loadsave() :问题是原先已经都用这个了,不想做太大的改变嘛!
      

  4.   

    你可以用collection参数啊,为什么不用?
      

  5.   

    to caiyi0903(willpower) :collection参数好像是options的,我不知道用那个跟option会有什么区别?是不是用option就不能实现拉?
      

  6.   

    <html:select property="type">           
       <logic:iterate id="item" name="allType" type="TypeDB">
            <bean:define id="type" property="item"/>
           <html:option  value="<%=type%>"><bean:write name="item" property="type"/></html:option>
        </logic:iterate>            
    </html:select><html:errors property="type"/>----------------------------------------
    这样就可以,不过我一直用<html:options />感觉比较方便,你不妨试试。
      

  7.   

    to kevinc(df31):我把它改成这样,好像还是不行阿
    <html:select property="type">           
       <logic:iterate id="item" name="allType" type="TypeDB">
          <bean:define id="type"  property="type"/>           
          <html:option  value="<%=type%>"><bean:write name="item" property="type"/></html:option>
               </logic:iterate>           
    </html:select><html:errors property="type"/>
    怎么回事?
      

  8.   

    对不起楼主,这段代码我没测试,有错误。
    <bean:define id="type"  property="type" />少了个参数 ,十分抱歉应为<bean:define id="type"  property="type" name="item"></bean:define>我现在没有环境,你可以自己测试一下,应该没什么问题了。
      

  9.   

    to  kevinc(df31):
    没关系,不过改为<bean:define id="type"  property="type" name="item"></bean:define>还是有问题:错误如下
    cannot resolve symbol
    symbol  : method setValue (java.lang.Object)
    location: class org.apache.struts.taglib.html.OptionTag
              _jspx_th_html_option_0.setValue(type);
      

  10.   

    bean:define语句改为:<bean:define id="type" name="item" property="type"/>
      

  11.   

    to loadsave() :这样还是一样的阿,没有区别,跟上面!
      

  12.   

    那把define 里的id改个其他名字试试,我也没环境,感觉没错了啊。
      

  13.   

    <html:select  property="type">
    <html:options collection="List" property="value" labelProperty="type"/>
    </html:select>
      

  14.   

    to loadsave() : 好像跟id的名字没关系的,我改了好多都不行,是不是问题出在
     <html:option  value="<%=type%>">,它会报type  cannot resolve symbol,是不是type没定义成功?
      

  15.   

    to zerorain(零度雨) :难道一定要用options了嘛?option不可以实现嘛?
    急阿
      

  16.   

    <html:select style="select" property="kaigiRankId">
    <html:optionsCollection property="kaigirankList"/>
    </html:select>楼主,请使用optionsCollection 标签!!!!!!!!!!!他的property是一个list,在frombean中定义过!
      

  17.   

    如果我用options的话,value的值跟显示的值不一样,这样可以实现嘛?
      

  18.   

    还有谁可以帮我嘛?最好是能用option就可以实现拉!这样可能改动少点
      

  19.   

    下面代码可以运行            <html:select name="xxsdForm" property="xlid" styleId="queryXlid" styleClass="SelectStyle" style="width:150px" onchange="selectGtxx()">
               <option value="">请选择***</option>
                      <logic:notEmpty name="listQueryXlid">
                      <logic:iterate id="xlxx" name="listQueryXlid" type="zzxy.model.sd.po.PO_SDCS_XLXX">
                      <option value="<bean:write name='xlxx' property='xlid' />"><bean:write name="xlxx" property="xlid" /></option>
                    </logic:iterate>
                      </logic:notEmpty>
                </html:select>
                <script language="JavaScript">
             document.all("queryXlid").value = "<bean:write name='xxsdForm' property='xlid'/>";
                </script>
      

  20.   

    我把html:option  value="<%=type%>"><bean:write name="item" property="type"/></html:option>
    改成<option  value="<%=type%>"><bean:write name="item" property="type"/></option>就可以了,这样是不是就是用一般的html,而不是用taglib了吧?不知道这样会不会有什么问题呢?高手可以指点下嘛?