1. Get access IP in the action :
ServletActionContext.getRequest().getRemoteHost();
2.Get session in the action and set value:
ServletActionContext.getRequest().getSession().setAttribute("userName","Jone");
3.Get session value in the action:
ServletActionContext.getRequest().getSession("userName");
4.struts2 interceptor:
please look this url content:http://zhidao.baidu.com/link?url=c0bN_-MNzHzadGWC6u9nnGKAYqRkUPL49ozepWZUMjKJ1ET0MHrIGLGPyxSsb9-8xuH7vVKHhK8q1W55zPa8va
5.if you add your interceptor in the struts.xml file ,
you must do this :
add the <interceptor-ref name="defaultStack"/>
into configuration,otherwise struts2 will can't find struts2 framework default interceptor
ServletActionContext.getRequest().getRemoteHost();
2.Get session in the action and set value:
ServletActionContext.getRequest().getSession().setAttribute("userName","Jone");
3.Get session value in the action:
ServletActionContext.getRequest().getSession("userName");
4.struts2 interceptor:
please look this url content:http://zhidao.baidu.com/link?url=c0bN_-MNzHzadGWC6u9nnGKAYqRkUPL49ozepWZUMjKJ1ET0MHrIGLGPyxSsb9-8xuH7vVKHhK8q1W55zPa8va
5.if you add your interceptor in the struts.xml file ,
you must do this :
add the <interceptor-ref name="defaultStack"/>
into configuration,otherwise struts2 will can't find struts2 framework default interceptor