id代表了一个Bean的名称
name代表了你需要叠代的属性如果没有name,那么id代表的那个东西应该是可以叠代的The collection to be iterated over MUST conform to one of the following requirements in order for iteration to be successful:
An array of Java objects (but not primitive data types such as "int") 
An implementation of java.util.Collection, including ArrayList and Vector. 
An implementation of java.util.Enumeration. 
An implementation of java.util.Iterator. 
An implementation of java.util.Map, including HashMap, Hashtable, and TreeMap. NOTE - See below for additional information about accessing Maps.

解决方案 »

  1.   

    e.g.
    <bean:write name="test" property="pp" filter="true"/>
    name="test" 是你通過循環(logic:iterate)得到的一個對象,你這個對象裏面必須
    存在getPp()這樣的方法,你才可以這樣使用
      

  2.   

    <bean:write name="employee" property="name" filter="true"/>
    bean里有setName,getName,等等
      

  3.   

    先谢谢各位大师;但我在一个例子中看到的是;
    <logic:iterate id="employee" name="employees">
    他只是在调用该页面中的ActionServlet中找到一个getemployees方法
    不过例子调不通,所以很怀疑他这样对不对。
      

  4.   

    Aa
    ActionServlet里面应该有session.setAttribute("employees", 集合或类),id是它实例化;
      

  5.   


    比如你在action中
    MyJavaBean[] javabean = new MyJavaBean[3];

    request.getSession().setAttribute("mybean",javabean);<logic:iterate id="id" name="mybean" 
      <bean:write name="id" ..
    这里的name是一个数据集合,她相当于
    for(int i =0; i<javabean.length; i++ )
    {
       <bean:write...//当然这里的write就相当于调用javabean[i].get方法
    }
      

  6.   

    楼上的改成
    MyJavaBean[] javabean = new MyJavaBean[3];

    request.getSession().setAttribute("mybean",javabean);<logic:iterate id="testId" name="mybean" property="myArr"...>
    <tr>
    <%  UserData data = (UserData)testId;

    String userName = data .getName();
             String userPass = data.getPass();
    %>
        <td><%=userName%></td>
        <td><%=userPass%></td>
    </tr>
    </logic:iterate>myArr对应在javaBean里面有get,set方法
    然后就可以用了,testId是从集合myArr里面自动取出的实例,我们假设myArr里面装着一个个得user自定义类你啊明白啦?
     
      

  7.   

    楼上的用法是不可取的,不过你这样能说明道理。
    显示的时候还是应该用struts的标签呀
    这样的话你的jsp里面还是有scriptlet这样的东西,就不能算是java和jsp完全分离的
    这不是好的代码,也没有整真利用好这个struts的框架
      

  8.   

    我加了句 request.setAttribute("employees", getEmployees());就可以了.可见"尽信书不如无书"
    谢谢各位
      

  9.   

    呜,sandyen(杉叶)的话我没有考虑过,只是一直都这么用,显示起来也比较的方便
    我研究研究啊,多谢提点