You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ch...@highmark.com on 2007/08/29 20:43:25 UTC
Multiple Struts Config - Using the form tag
Hi all,
I have an application which uses multiple struts-config files. I'm trying
to add a new one in which there will be an action which I want to be
called when a particular jsp submit button is depressed. As I would with
a single struts-config file, I'm just constructing a form tag like this:
<html:form action="someAction" method="post">
where someAction is defined in struts-module2.xml
The web.xml defines the second module like this:
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/config/struts-default.xml</
param-value>
</init-param>
<init-param>
<param-name>config/module2</param-name>
<param-value>/WEB-INF/config/struts-module2.xml</
param-value>
</init-param>
When I run the jsp, it can't find the action. I highly suspect this is
because the struts custom tag library is building a URL for the action
based on my web-context and not including the module name. Then it is
looking for the URL. Of course it isn't found because the URL should
include the module name which in this case is
"/context/module2/someAction.do". I would think though that struts is
smart enough to manipulate the URL until it finds a config file that
contains the action! The error message I get is:
Error 500: Cannot retrieve mapping for action: "/someAction"
I can make the error go away buy putting the action in the default
struts-config. I could deal with this using a javascript submit button,
or some other creative solution, but I'd rather do it the "right" way. Any
ideas? Is this a bug?
Regards,
Chris
Re: Multiple Struts Config - Using the form tag
Posted by Paul Benedict <pb...@apache.org>.
My recommendation is to remove the use of modules. You can do this instead:
<init-param>
<param-name>config</param-name
<param-value>/WEB-INF/struts-a.xml,/WEB-INF/struts-b.xml</param-value>
</init-param>
Paul