自己读这个文件吧。InputStream is = getClass.getResourceAsStream(request.getSession().getServletContext().getInitParameter("contextConfigLocation")) ;Digester d= new Digester();d.addObjectCreate("/xxx/yyyy/",YYyyyy.class);从来没有用过 Hibernate ,不知道 这个 applicationContext.xml 啥内容。
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext());
IXXXService service = (IXXXService)ctx.getBean("IXXXService");通过这样的方法可以方便的在jsp中得到applicationContext.xml中定义的Bean。