You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mineau, Christian" <ch...@cgi.com> on 2006/02/16 20:03:08 UTC

Problem forwarding to an action in another webapp

We develop an application with Struts MVC. In this application, we have
two webApps containing some Struts Actions in each one (i.e two
Struts-config.xml files). These both webApps are in separate EAR files.


 

Example: 

Webapp1 contains action11 and action12

Webapp2 contains action21 and action22

 

My concern is when I'm in the action11 and I want forward in the
action22 directly I found the error "Invalid path was requested". I
tried this configuration:

 

<action path="/action11" type="ca.xyz.Action11" name="action11Form"
parameter="event">

            <forward name="success"
path="/Webapp2/action22.do?event=initCreate"/>

</action> 

 

Somebody can help me,

Thx.


Re: Problem forwarding to an action in another webapp

Posted by Alexandre Simon <le...@newel.net>.
Oups... I didn't saw the webapps were in SEPARATE ear files... you will 
probably encounter some bad classloader issues.
Do a redirect, not a forward.

Michael Jouravlev wrote:

>On 2/16/06, Mineau, Christian <ch...@cgi.com> wrote:
>  
>
>>We develop an application with Struts MVC. In this application, we have
>>two webApps containing some Struts Actions in each one (i.e two
>>Struts-config.xml files). These both webApps are in separate EAR files.
>>
>>
>>
>>
>>Example:
>>
>>Webapp1 contains action11 and action12
>>
>>Webapp2 contains action21 and action22
>>
>>
>>
>>My concern is when I'm in the action11 and I want forward in the
>>action22 directly I found the error "Invalid path was requested". I
>>tried this configuration:
>>
>>
>>
>><action path="/action11" type="ca.xyz.Action11" name="action11Form"
>>parameter="event">
>>
>>            <forward name="success"
>>path="/Webapp2/action22.do?event=initCreate"/>
>>
>></action>
>>
>>
>>
>>Somebody can help me,
>>
>>Thx.
>>    
>>
>
>You want redirect instead of forward, so put redirect="true" to your
>forward (is it true by default?) You may also need to patch your
>URL/context as well. This is essentialy a different web site.
>
>Michael.
>
>---------------------------------------------------------------------
>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


Re: Problem forwarding to an action in another webapp

Posted by Michael Jouravlev <jm...@gmail.com>.
On 2/16/06, Mineau, Christian <ch...@cgi.com> wrote:
> We develop an application with Struts MVC. In this application, we have
> two webApps containing some Struts Actions in each one (i.e two
> Struts-config.xml files). These both webApps are in separate EAR files.
>
>
>
>
> Example:
>
> Webapp1 contains action11 and action12
>
> Webapp2 contains action21 and action22
>
>
>
> My concern is when I'm in the action11 and I want forward in the
> action22 directly I found the error "Invalid path was requested". I
> tried this configuration:
>
>
>
> <action path="/action11" type="ca.xyz.Action11" name="action11Form"
> parameter="event">
>
>             <forward name="success"
> path="/Webapp2/action22.do?event=initCreate"/>
>
> </action>
>
>
>
> Somebody can help me,
>
> Thx.

You want redirect instead of forward, so put redirect="true" to your
forward (is it true by default?) You may also need to patch your
URL/context as well. This is essentialy a different web site.

Michael.

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


Re: Problem forwarding to an action in another webapp

Posted by Alexandre Simon <le...@newel.net>.
Action path is relative to the current webapp.
What you want is a crosscontext forward, ie. : 
getServletContext().getContext("/Webapp2").getRequestDispatcher("/action2.do").forward(...)

Be sure your container accept it.

Hope helps.

Mineau, Christian wrote:

>We develop an application with Struts MVC. In this application, we have
>two webApps containing some Struts Actions in each one (i.e two
>Struts-config.xml files). These both webApps are in separate EAR files.
>
>
> 
>
>Example: 
>
>Webapp1 contains action11 and action12
>
>Webapp2 contains action21 and action22
>
> 
>
>My concern is when I'm in the action11 and I want forward in the
>action22 directly I found the error "Invalid path was requested". I
>tried this configuration:
>
> 
>
><action path="/action11" type="ca.xyz.Action11" name="action11Form"
>parameter="event">
>
>            <forward name="success"
>path="/Webapp2/action22.do?event=initCreate"/>
>
></action> 
>
> 
>
>Somebody can help me,
>
>Thx.
>
>
>  
>


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