在action中獲取session有兩種方法:
第一種直接獲取:
Map<String,Object> session = ActionContext.getContext().getSession();
第二種:
((HttpServletRequest) ActionContext.getContext().get(StrutsStatics.HTTP_REQUEST)).getSession().getAttribute("");
在jsp中獲取session:
在jsp中內置有session對象,可以直接使用。
例如:session.getAttribute("");