You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tiago Henrique Costa Rodrigues Alves <ti...@bsb.politec.com.br> on 2003/12/15 14:59:50 UTC
Multiple struts-config files
I am testing the struts-blank example, I made some changes to try use
multiple config files....
I defined my web.xml like this:
<init-param>
<param-name>config/action-mappings</param-name>
<param-value>/WEB-INF/action-mappings.xml</param-value>
</init-param>
<init-param>
<param-name>config/form-beans</param-name>
<param-value>/WEB-INF/form-beans.xml</param-value>
</init-param>
<init-param>
<param-name>config/data-sources</param-name>
<param-value>/WEB-INF/data-sources.xml</param-value>
</init-param>
<init-param>
<param-name>config/global-exceptions</param-name>
<param-value>/WEB-INF/global-exceptions.xml</param-value>
</init-param>
<init-param>
<param-name>config/global-forwards</param-name>
<param-value>/WEB-INF/global-forwards.xml</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
And for my action-mappings I defined the action-mapping.xml like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- =================================== Action Mapping Definitions -->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/Welcome"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Welcome.jsp"/>
<!-- sample input and input submit actions
<action
path="/Input"
type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Input.jsp"/>
<action
path="/InputSubmit"
type="app.InputAction"
name="inputForm"
scope="request"
validate="true"
input="/pages/Input.jsp"/>
end samples -->
</action-mappings>
</struts-config>
And I got the followin error:
javax.servlet.ServletException: Cannot create redirect URL:
java.net.MalformedURLException: Cannot retrieve ActionForward named welcome
How can I correctly support multiple config files?
Tiago Henrique C. R. Alves
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Multiple struts-config files
Posted by Philip Mark Donaghy <go...@yahoo.com>.
In Struts 1.1, you have two options: you can list
multiple struts-config files as a comma-delimited
list, or you can subdivide a larger application into
modules.
Do so in the web.xml file. Add the <init-param> tag to
the <servlet> tag.
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/conf/struts-default.xml,another-struts-config.xml</param-value>
</init-param>
-- OR --
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/conf/struts-default.xml</param-value>
</init-param>
<init-param>
<param-name>config/module1</param-name>
<param-value>/WEB-INF/conf/struts-module1.xml</param-value>
</init-param>
Phil
=====
Java Web Application Architect
mapimage.com - Java and GIS
struts1.1:tomcat4.1.27:linuxRH8
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org