<logic:iterate item="element" list="list">
      <bean:write name="element.column">//大概是name属性,不清楚了,element.column是指每个元素的列
</logic:iterate>

解决方案 »

  1.   

    list里存的是什么值呀,一个个map,还是其它的,要是map,在页面上就
    <c:forEach var="stu" items="${requestScope.student}">
    <tr><td>${stu.key1}</td><td>${stu.key2}</td></tr>
    </c:forEach>
      

  2.   

    楼主既然用了struts那就用struts的标签吧.会比jstl用起来简单.
      

  3.   

    可以使用struts的<logic:iterate>嵌套来迭代
    打个比方,比如你的父集合叫student,里面的每一个对象还包含一个子集合叫love
    <logic:iterate name="student" id="stu"> 
          <logic:iterate name="stu" property="love" id="stuLove"> 
                 <bean:write name="stuLove"> 
           </logic:iterate>
    </logic:iterate>
      

  4.   

    这个是我的hql语句
      hql="from Stuclass sc,Student s where sc.id=s.stuclass.id and sc.id=1";
    我是通过班级表的ID(id)等于学生表的班级ID(classid)并且班级表的ID(id=1)查结果的
     最终显示的是班级ID=1的所有的学生信息 包括班级表里的名称等页面是这样写的 
    <logic:iterate id="stu" name="student">
        <tr>
          <td align="center">这里该怎样写</td>
          ...
        </tr>
    </logic:iterate>
      

  5.   

    说清楚你LIST 里的数据是什么样子的啊,比如里面是 list ,还是 map ,还是一个对象的各个属性,这个熟悉又是什么类型的
      

  6.   

    是list,里面是两个表信息的集合。 
      

  7.   

    举例:
    student        学生信息集合
         name:     学生姓名
         age:      年龄
    class_Id:     学生表中的班级Idclass          班级表
      classId:     班级id
    className:    班级名称因为是多表关联,那每一个学生对象中 class_Id 其实是班级对象
    <c:forEach var="stu" items="${requestScope.student}"> 
    <tr>
       <td>${stu.name}</td>  //姓名
       <td>${stu.age }</td>   //年龄
       <td>${stu.class_Id.className}</td> //学生所在班级名称
    </tr> 
    </c:forEach>
      

  8.   

    hql语句是查一个表时可以这样写  ${stu.name} 
       两个表联合这样写 页面出错
       这个是我的hql语句 
      hql="from Stuclass sc,Student s where sc.id=s.stuclass.id and sc.id=1"; 
    错误:
      javax.servlet.ServletException: The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer.
      

  9.   

    hql="from Stuclass sc,Student s where sc.id=s.class_id and sc.id=1"; sc.id  =======>班级表中的班级id
    s.class_id =====>学生表中的班级id
      

  10.   

    看你的id是什么类型的,如果不是int 型的,sc.id=1 要改成 sc.id='1'
      

  11.   

    没有什么好不好用 看你对哪个熟悉,当然都会是最好的 我喜欢jstl标准标签 毕竟logic是依附于struts1.*的
    java.util.List l=(java.util.List)request.getAttribute("list");
    java.util.Iterator i=l.iterator();
    while(i.hasNext()){
    object[] d=(object[])i.next();<%=d[0]%>
    <%=d[0]%>最后得到的放一个数组里,遍历就可以得到了
    这方法我用过
      

  12.   

    都是int型的,我弄出来了 hql语句改了 改成查一个表
      班级的名称 用${stu.stuclass.className} 就出来了 谢谢大家
    又回到用jstl了 struts标签也没用到