struts2提供如下方式访问 Servlet API
1.ActionContext
-static ActionContext getActionContext()
>>该静态方法返回ActionContext实例
-Map getParameters()
>>该方法和HttpServletRequest对象中的getParameterMap方法对应
- Map getSessoin()
>>Map中保存的是Seesion作用域内的对象
2.实现如下接口
-ServletContextAware
>>通过依赖注入可用得到ServletContext对象
-ServletRequestAware
>>通过依赖注入可用得到HttpServletRequest对象
-ServletResponseAware
>>通过依赖注入可用得到HttpServletResponse对象
3.ServletActionContext
-static PageContext getPageContext()
>>得到PageContext对象
-static HttpServletRequest getRequest()
>>得到HttpServletRequest对象
-static HttpServletResponse getResponse()
>>得到HttpServletResponse对象
-static ServletContext getServletContext()
>>得到ServletContext对象