actionform

Struts and Spring together?

喜夏-厌秋 提交于 2019-12-05 04:21:25
问题 I am pretty new to both Struts and Spring. I need to know how to access a Spring Service in a Struts ActionForm. Even a pointer in the right direction would be appreciated. 回答1: From a struts 1 ActionForm class you'll be needing: WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean("yourService"); 回答2: Are you using Struts 1 or 2? If you're using Struts 1 then there are couple of ways of doing it. I prefer to do it using org.springframework.web.struts

Struts and Spring together?

徘徊边缘 提交于 2019-12-03 22:07:14
I am pretty new to both Struts and Spring. I need to know how to access a Spring Service in a Struts ActionForm. Even a pointer in the right direction would be appreciated. From a struts 1 ActionForm class you'll be needing: WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext).getBean("yourService"); Are you using Struts 1 or 2? If you're using Struts 1 then there are couple of ways of doing it. I prefer to do it using org.springframework.web.struts.DelegatingActionProxy. You'll need to have the spring-webmvc-struts.jar in the classpath. struts-config.xml: <action path="