读书人

JSP页面调用Spring器皿注入的Bean

发布时间: 2012-12-17 09:31:40 作者: rapoo

JSP页面调用Spring容器注入的Bean
首先在jsp中导入:

<%  WebApplicationContext context = (WebApplicationContext)this.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);  TestService service = (TestService)context.getBean("bean ID");  %>

读书人网 >JavaScript

热点推荐