在action中获取session有两种方法:
第一种直接获取:
Map<String,Object> session = ActionContext.getContext().getSession();
第二种:
((HttpServletRequest) ActionContext.getContext().get(StrutsStatics.HTTP_REQUEST)).getSession().getAttribute("");
在jsp中获取session:
在jsp中内置有session对象,可以直接使用。
例如:session.getAttribute("");
本文介绍了在Struts框架中两种获取Session的方法:一种是在Action中直接通过ActionContext获取,另一种是通过HttpServletRequest对象获取。此外,还提到了在JSP页面中如何使用内置的session对象来获取属性。
209

被折叠的 条评论
为什么被折叠?



