You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Manfred Wolff <mw...@neusta.de> on 2003/03/07 09:42:01 UTC
Multiple application support
Hi
I have some problems with struts multiple application support. I have
build a second struts-config.xml called common-struts-config.xml and I
have registered it in the web.xml.
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/common</param-name>
<param-value>/WEB-INF/struts-config-common.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>4</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>4</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
In my Index.jsp I have the folloging tag:
<html:form action="/common/TempException.do" method="post">
and I get an exception. I have debuged struts and I might have found the
problem in the html:form tag but in the requestUtils.
In FormTag.java line 713:
moduleConfig = RequestUtils.getModuleConfig(pageContext);
And the procedure in RequestUtils:
public static ModuleConfig getModuleConfig(PageContext pageContext) {
ModuleConfig moduleConfig =
(ModuleConfig)
pageContext.getRequest().getAttribute(Globals.MODULE_KEY);
if (moduleConfig == null) { // Backwards compatibility hack
moduleConfig =
(ModuleConfig)
pageContext.getServletContext().getAttribute(Globals.MODULE_KEY);
}
return moduleConfig;
}
It searches only in the default module and not in the several
modul-configuration. So I think here is one problem.
Just my question: Has anyone have succeed with multiple
struts-config-modules. Perhaps I make a mistake.
Manfred
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Multiple application support
Posted by Thomas CORNET <th...@cornet.name>.
Had the same problem.. You need to pass through the struts controller to
use the modules, because this is the controller which is able to determine
in which module you are. So you need to browse the result of an action to
use modules. Just create an action without form in your
struts-config-common.xml such as :
<action path="/index" type="package.IndexAction" validate="false">
<forward name="ok" path="/index.jsp" />
With a void action such as
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
return mapping.findForward("ok");
}
And try to test 'http://localhost/app/common/index.do' instead of
'http://localhost/app/common/index.jsp', this should work well :)
Thomas
At 09:42 07/03/2003, you wrote:
>Hi
>
>I have some problems with struts multiple application support. I have
>build a second struts-config.xml called common-struts-config.xml and I
>have registered it in the web.xml.
>
> <servlet>
> <servlet-name>action</servlet-name>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> <init-param>
> <param-name>config</param-name>
> <param-value>/WEB-INF/struts-config.xml</param-value>
> </init-param>
> <init-param>
> <param-name>config/common</param-name>
> <param-value>/WEB-INF/struts-config-common.xml</param-value>
> </init-param>
> <init-param>
> <param-name>debug</param-name>
> <param-value>4</param-value>
> </init-param>
> <init-param>
> <param-name>detail</param-name>
> <param-value>4</param-value>
> </init-param>
> <load-on-startup>2</load-on-startup>
> </servlet>
>
>In my Index.jsp I have the folloging tag:
>
>and I get an exception. I have debuged struts and I might have found the
>problem in the html:form tag but in the requestUtils. In FormTag.java line
>713: moduleConfig = RequestUtils.getModuleConfig(pageContext); And the
>procedure in RequestUtils: public static ModuleConfig
>getModuleConfig(PageContext pageContext) { ModuleConfig moduleConfig =
>(ModuleConfig) pageContext.getRequest().getAttribute(Globals.MODULE_KEY);
>if (moduleConfig == null) { // Backwards compatibility hack moduleConfig =
>(ModuleConfig)
>pageContext.getServletContext().getAttribute(Globals.MODULE_KEY); } return
>moduleConfig; } It searches only in the default module and not in the
>several modul-configuration. So I think here is one problem. Just my
>question: Has anyone have succeed with multiple struts-config-modules.
>Perhaps I make a mistake. Manfred
>--------------------------------------------------------------------- To
>unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For
>additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org