You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Purcell <sp...@vertisinc.com> on 2005/04/26 15:38:22 UTC

Multiple Modules Still Have Issues

Hello,

I am trying to create two modules. I am following the docs here:
http://struts.apache.org/userGuide/configuration.html

What I have done, is create both entries in my web.xml file like the example shows:
  <servlet>
    <servlet-name>unique</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/module1</param-name>
      <param-value>/WEB-INF/struts-module1.xml</param-value>
    </init-param>


Now I am on the default side, and I entered a entry like so, to use the forwards to the other side (module1, struts-module1.xml) like so:
    <forward name="/foobar" contextRelative="true" path="/module1/foobar.do" redirect="true"/>

Now in the struts-module1.xml I do have an entry like so:
 <action path="/foo" forward="/html-multibox.jsp" />

At a web-browser, I enter this url:
http://localhost/unique/foobar.do in doing so, I would assume that I would be calling the default side, with the foobar.do forward, which would then call the other module with a path of foo, thus displaying the /html-multibox.jsp page.

But, instead I get the error each time that states:
[ERROR] RequestProcessor - Invalid path /foobar was requested

Any ideas what I am doing wrong? Is the path wrong in the forward from the default side?

Any help would be appreciated. 

Also, in my default app, I have extended the RequestProcessor, do I need that entry in my "module1" struts-config.xml. I couldn't find any information on that.

Thanks,
Scott



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Multiple Modules Still Have Issues

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Scott,

>From what you have included, your understanding of struts seems incorrect.
The /*.do Struts mappings only work with "Actions", not "forwards."  The
forwards are used internally by your actions (which return ActionForwards)
and cannot be seen over the web as a direct url.  So, to reach
/unique/foobar.do, you will need an action with the attribute/value of
'path="/foobar"'.  You could have your action's execute() method return
mapping.findForward("foobar") to get to /module1/foobar.do.  Also, you
probably want to change your forward so instead of

path="/module1/foobar.do" ...etc...

You have

path="/foobar.do" module="/module1" ...etc...

See the struts-config_1_2.dtd for more details on the pieces of a "forward"
within the struts-config.xml (or module) files.

Regards,
David

-----Original Message-----
From: Scott Purcell [mailto:spurcell@vertisinc.com]
Sent: Tuesday, April 26, 2005 9:38 AM
To: user@struts.apache.org
Subject: Multiple Modules Still Have Issues


Hello,

I am trying to create two modules. I am following the docs here:
http://struts.apache.org/userGuide/configuration.html

What I have done, is create both entries in my web.xml file like the example
shows:
  <servlet>
    <servlet-name>unique</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/module1</param-name>
      <param-value>/WEB-INF/struts-module1.xml</param-value>
    </init-param>


Now I am on the default side, and I entered a entry like so, to use the
forwards to the other side (module1, struts-module1.xml) like so:
    <forward name="/foobar" contextRelative="true" path="/module1/foobar.do"
redirect="true"/>

Now in the struts-module1.xml I do have an entry like so:
 <action path="/foo" forward="/html-multibox.jsp" />

At a web-browser, I enter this url:
http://localhost/unique/foobar.do in doing so, I would assume that I would
be calling the default side, with the foobar.do forward, which would then
call the other module with a path of foo, thus displaying the
/html-multibox.jsp page.

But, instead I get the error each time that states:
[ERROR] RequestProcessor - Invalid path /foobar was requested

Any ideas what I am doing wrong? Is the path wrong in the forward from the
default side?

Any help would be appreciated.

Also, in my default app, I have extended the RequestProcessor, do I need
that entry in my "module1" struts-config.xml. I couldn't find any
information on that.

Thanks,
Scott



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org