SSH框架将信息存到session中并在页面上显示

1、Action中:

1 HttpServletRequest request=(HttpServletRequest) ServletActionContext.getRequest();
2 HttpSession session=request.getSession();
3 session.setAttribute("Admin", admin);

2、jsp页面获取:

用struts标签: <s:property value="#session.Admin.adminName" />

用EL表达式:${session.Admin.adminName}

用java代码:<%=session.getAttribute("Admin.adminName")%>

posted @ 2019-04-26 16:34  He123456789  阅读(866)  评论(0编辑  收藏  举报