一、在後臺創建request對象;
二、將List集合放到request中;
三 、在返回的頁面中遍歷list集合;
HttpServletRequest request = ServletActionContext.getRequest();
List<User> userList = userService.findAllUser();
request.setAttribute("userlist", userList);
用“s” 標籤遍歷
<table>
<s:iterator value="userList">
<tr>
<td><s:property value="id"/> </td>
<td><s:property value="username"/> </td>
<td><s:property value="password"/> </td>
</tr>
</s:iterator>
</table>
用"c"標籤遍歷
<table>
<c:forEach var="list" items="${userlist}">
<tr>
<td>${list.id}</td>
<td>${list.username}</td>
<td>${list.password}</td>
</tr>
</c:forEach>
</table>