PDA

View Full Version : struts+spring


india
08-17-2004, 01:01 PM
Hi,
I have two submodules in struts application. I have defined the spring contextLoaderPlugIn in each
submodule sub1-config.xml(default) & sub2-config.xml(/test) file. Also i have two set of beans,each defined in its own
spring xml file. I was wondering if this is the right way to setup. since i get an error saying, "No bean named
'test' is defined:..." ,while trying to access the bean in a particular module action class. It finds bean for one module but not for other.
I see the beans getting loaded for each contextLoaderPlugin?



<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/spring/springbean1.xml"/>
</plug-in>

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/spring/springbean2.xml"/>
</plug-in>

Thanks

james.estes
08-17-2004, 03:51 PM
Support for this was added in 1.1 RC 1. Be sure to set the name attribute for the bean to the full path of the action mapping (including the module prefix).
<bean id="testAction" name="test/testAction" class="com.foo.TestAction"/>
Where you have an action mapping in the sub2-config.xml with a path of "/testAction".

india
08-17-2004, 04:01 PM
Thanks.