日期:2014-05-17 浏览次数:20705 次
<!-- 配置User的Action --> <bean name="/upload" class="com.jdim.user.struts.action.PhotoAction"> <property name="servlet"> <bean class="org.apache.struts.action.ActionServlet"/> </property> <property name="photoService" ref="photoService" /> </bean>
<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener>
------解决方案--------------------
action中这样:记得把spring web 的包也要选进来
WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServlet() .getServletContext()); LoginService ls = (LoginService) wac.getBean("loginService");
------解决方案--------------------
如果不会,看我发布的资源:
http://download.csdn.net/source/1147273