在Controller中须要有参数
spring
如:.net
public void testController(HttpServletRequest request){blog
//Spring上下文
WebApplicationContext ac1= WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
//springMVC上下文
WebApplicationContext ac2 = RequestContextUtils.getWebApplicationContext(request);get
}
io
对比一下struts2 对上下文的获取;
test
http://blog.csdn.net/lxl_family/article/details/12715337struts2