jsp文件:
<%@ page import="javax.servlet.ServletContext" %>
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%
//獲取ApplicationContext對象
ServletContext servletContext = request.getSession().getServletContext();
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
//獲取ApplicationContext.xml文件中定義的BEAN
PictureService ps=(PictureService)ac.getBean("pictureService");