struts2访问session的两种形式

struts2访问session的两种方式。

 

    1、从ActionContext中获取;

ActionContext.getContext().getSession();

 

 

    2、实现SessionAware接口。

protected Map<String, Object> session;

public void setSession(Map<String, Object> session) {
 this.session=session
}