JSP中如何获取spring 容器呢?
// 获取spring容器
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
// 插件数据初始化
ICommonService commonService = (ICommonService) ctx.getBean("commonService");
commonService.init();
?
ServletContext context = request.getSession().getServletContext(); ApplicationContext ctx = WebApplicationContextUtils .getWebApplicationContext(context);
?
原文:http://hw1287789687.iteye.com/blog/2177093