Loading

springMvc获取servletContext

springMvc获取servletContext

//  001
WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();
ServletContext servletContext = webApplicationContext.getServletContext();


// 002 这个可以是2.5规范下面使用
RequestContextUtils.getWebApplicationContext(request).getServletContext();


// 003 这个是3.0规范的;
ServletContext context = req.getServletContext();

 

posted @ 2016-08-31 13:49  stono  阅读(9185)  评论(0编辑  收藏  举报