在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