Struts2获取web资源的四种方式
来源:互联网 发布:2018域名 编辑:程序博客网 时间:2024/06/05 16:56
方式一:拦截器方式
实现ServletRequestAware接口,可以获取request(ServletRequest类型)对象实现ServletResponseAware接口,可以获取response(ServletResponse类型)对象实现ServletContextAware接口,可以获取servletContext(ServletContext类型)对象
方式二:使用RequestAware拦截器
实现RequestAware接口可在同一个方法内部同时获取到三种(ServletRequest类型)request = (ServletRequest)arg0.get(StrutsStatics.HTTP_REQUEST)......
方式三:使用struts2的静态对象获取
(1):使用ActionContext对象
ActionContext ac = ActionContext.getContext()(ServletRequest类型)request = (ServletRequest)ac.get(ServletActionContext.HTTP_REQUEST)......
(2)通过ServletActionContext对象直接获取(推荐)
ServletRequest request = ServletActionContext.getRequest()ServletResponse response = ServletActionContext.getResponse()ServletContext Context = ServletActionContext.getServletContext()
0 0
- Struts2获取web资源的四种方式
- Struts2 Web 资源获取的四种方式
- Struts2 Web 资源获取的四种方式
- Struts2获取Web容器资源的方式
- struts2 中获取 web资源的方式
- struts2获取web资源4种方式
- Struts2 Web 资源获取的4种方式
- struts2获取web资源方式
- Struts2获取Web容器资源的方式 访问request,session
- Struts2通过ActionContext解耦的方式获取WEB资源
- Struts2通过Aware方式获取WEB资源
- struts2获取requestd session 等web元素的四种方式
- Struts2-耦合方式和非耦合方式获取WEB资源
- Struts2中访问web元素的四种方式及前台jsp页面获取后台值的方式
- Struts2中访问web元素的四种方式及前台jsp页面获取后台值的方式
- Struts2中访问web元素的四种方式及前台jsp页面获取后台值的方式
- Struts2中访问web元素的四种方式及前台jsp页面获取后台值的方式
- Struts2 Web 资源获取
- hdu-1233 还是畅通工程
- android:layout_gravity="bottom"不起作用问题
- 【poj 2234】Matches Game
- 基于V4L2驱动程序的USB摄像头Android(JNI)的编写(三)
- HID设备类
- Struts2获取web资源的四种方式
- Makefile 语法中的自动化变量与函数
- 天声人語 20150811
- 20-01-其他对象API(System类)
- ZOJ 3541 - The Last Puzzle(区间dp)
- not in与 id!=效率对比分析
- bfs模板
- How to get file name when user select a file via <input type=“file” />?
- codeforce #200 div2 的水题三道