Advertisement

Udemy WW Udemy WW

Friday 16 December 2011

Access session In Action class (struts2)

You can get session on an ActionSupport based Action POJO class as follows:

 import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class searchAction extends ActionSupport
{  
public String execute() throws Exception {
ActionContext ctx= ActionContext.getContext();
   Map m=ctx.getSession();
   m.put("name", "value");
}
} 


1 comment:

Advertisement

Udemy WW