第一大类:得到Map类型
1,ActionContext.getContext.get("request") //是从值站的actionContext中得到
ActionContext.getContext.getSession():Map
2,implements SessionAware(推荐)
@override
setSession(Map session)
第二大类:得到如HttpServletRequest(原始类型)
1,ServletActionContext.getRequest();
2,implements ServletSessionAware
@override
setSession(HttpSession session)
action总结

本文介绍了在Struts框架中获取Session的两种主要方法:通过实现SessionAware接口并使用注解的方式设置Session,以及直接利用ServletActionContext获取HttpSession。此外,还提供了获取Map类型Session的方法。
457

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



