About the struts2 some problem

来源:互联网 发布:淘宝添加背景图片代码 编辑:程序博客网 时间:2024/05/21 12:40
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
0 0
原创粉丝点击