不知道你的对象具体是什么,用collection代替name试一下。好长时间不搞这东西了。记得好像是name要和property搭配。

解决方案 »

  1.   

    groups必须是数组,Collection,Enumeration,Iterator,Map中的一种
      

  2.   

    <logic:iterate id="element" collection="groups">不用name="groups",试过没有?
      

  3.   

    改成collection的话是另一个异常:
    javax.servlet.jsp.JspException: Cannot create iterator for this collection
      

  4.   

    Sometimes you want to iterate over a computed value rather than a bean property.
    In that case, you can use the collection attribute摘自《struts kick start>
    很清楚,如果是一个bean的属性,用name= property=,如果是一个独立的collection类型的bean,用collection=.
      

  5.   

    那Cannot create iterator for this collection这个异常又代表什么呢
      

  6.   

    <logic:notEmpty name="resultList">
        <logic:iterate id="currentList" name="resultList" indexId="index">
     <TR><TD height="20pt" style ="text-align:center" nowrap>
      <bean:write name="currentList" property="projectNo"/>
              </TD></TR>
       </logic:iterate>
    </logic>resultList 需要在formbean中定义过,然后给resultList赋值!
      

  7.   

    collection如果是formbean中的一个属性才行吗
    我把单独一个collection set进request里,
    按书上的说法应该也是可以的啊
      

  8.   

    如果是formbean的属性,用name= + property=的方式。如果是独立的bean,用collection=方式。
    javax.servlet.jsp.JspException: Cannot create iterator for this collection说明你的原来的对象类型不对,不是前面charlie0895(命)提到的类型。或是内部存储了不可序列化的对象。
      

  9.   

    类型是对的。Collection result = new ArrayList();
    存储的对象也是可序列化的。都result.add(group).
    group的类groupDTO都implement了Serializable接口
      

  10.   

    to serf():
    我发现把<% request.setAttribute("groups",new java.util.ArrayList()); %>
    放在<logic:present name="groups">的上面,
    反而是用name="groups"不会有异常;
    而用collection="groups"就依然有异常Cannot create iterator for this collection
    就是不知道为什么在本页set进request就能找到,
    在Action里设进request再转到本页就找不到
      

  11.   

    原来是checkbox的问题,
    循环中多个checkbox重名了。
    我真不小心。:)