JSP 获取Spring 注入对象示例
摘要:ServletContextsc=this.getServletConfig().getServletContext();Applicati...
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%> <%@ page import="org.springframework.context.ApplicationContext"%> ServletContext sc = this.getServletConfig().getServletContext(); ApplicationContext ac2 = WebApplicationContextUtils.getWebApplicationContext(sc);
要获取的对象 serv = (要获取的对象) ac2.getBean("spring配置文件中的id");
【JSP 获取Spring 注入对象示例】相关文章:
★ JSP开发入门
上一篇:
JSP中的倒数计时和自动跳转页面