1、struts2代码:
Map session=ActionContext.getContext().getSession();
List<User> list=userServiceImpl.listUser();
session.put("list", list);
//list.jsp
<s:iterator value="#session.list" id="li" status="st" var="x">
用户名:<s:property value="username"/>---
密码:<s:property value="password"/>---
<a href="update.jsp?id=<s:property value='id' />" href="_blank">修改</a>
<br/>
</s:iterator>
2、struts2代码
HttpServletRequest request=ServletActionContext.getRequest();
List<User> list=userServiceImpl.listUser();
request.setAttribute("list", list);
//list.jsp
<s:iterator value="#request.list" id="li" status="st" var="x">
用户名:<s:property value="username"/>---
密码:<s:property value="password"/>---
<a href="update.jsp?id=<s:property value='id' />" href="_blank">修改</a>
<br/>
</s:iterator>
3、struts2代码:
Map session=ActionContext.getContext().getSession();
List<User> list=userServiceImpl.listUser();
session.put("list", list);
//list.jsp
<s:iterator value="#session.list" id="li" status="st" var="lee">
用户名:<s:property value="#lee.username"/>---
密码:<s:property value="#lee.password"/>---
<a href="update.jsp?id=<s:property value='#lee.id' />" href="_blank">修改</a>
<br/>
</s:iterator>
4、struts2代码
HttpServletRequest request=ServletActionContext.getRequest();
List<User> list=userServiceImpl.listUser();
request.setAttribute("list", list);
//list.jsp
<s:iterator value="#request.list" id="li" status="st" var="lee">
用户名:<s:property value="#lee.username"/>---
密码:<s:property value="#lee.password"/>---
<a href="update.jsp?id=<s:property value='#lee.id' />" href="_blank">修改</a>
<br/>
</s:iterator>