public ActionForward doUserList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
List list = userBiz.ShowListUsers();
HttpSession session = request.getSession();
session.setAttribute("userList", list);
return null;
}
遇到个问题,我想在加载userList.jsp中直接读出session中的值,怎么做这是我的jsp代码,请问一下,怎么用<bean:define>这个标签啊,请说明下,谢谢大家了,<body>
<table>
<tr>
<td>
UID
</td>
<td>
用户名
</td>
<td>
密码
</td>
<td>
状态
</td>
</tr> <logic:notEmpty name="userList">

<logic:iterate id="user" name="userList">
<tr>
<td>
${user.userId}
</td>
<td>
${user.userName}
</td>
<td>
${user.password}
</td>
<td>
${user.status}
</td>
</tr>
</logic:iterate>
</logic:notEmpty> <logic:empty name="userList">
<tr>
<td colspan="3">
对不起没有用户
</td>
</tr>
</logic:empty>
</table>
</body>
</html>

解决方案 »

  1.   

    <c:forEach items="${userList}" var="user" varStatus="statu">
     ${user.userId}
    </c:forEach>
      

  2.   

     <logic:iterate   id="source"   name="yourlist"   indexId="index"   >   
                      <bean:define   id="id"   name="source"   property="id"/>     
                      <bean:define   id="name"   name="source"   property="name"/>   
      <bean:define   id="number"   name="source"   property="number"/>   
      <tr>     
                          <td   ><%=id%></td>   
                          <td><%=name%></td>   
                          <td   ><%=number%></td>   
                      </tr>   
          </logic:iterate>