关键代码:companyDao只是我自己用的一个Bean,可以替换成所需的Bean。
- <%@ page import="org.springframework.context.ApplicationContext"%>
- <%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
- <%
- ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
- CompanyDao companyDao= (CompanyDao)ctx.getBean("companyDao");
- %>