You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Baroukh <mb...@cardiweb.com> on 2007/03/01 14:47:37 UTC

forward to another action

I can't figure how to do this.
Can somebody help me ????

I wan't to forward an action to another with something like
requestDispatcher("/action.do?param1=value1").forward(req, res);

- I can't use redirect because I wan't to use the same request scope.
- I can't use chain because chain doesn't allow to add parameters.
- I can't use dispatcher because *.do is mapped to a filter and not a 
servlet. The application server doesn't find servlet to forward to 
(Result in file not found ...)
- I wan't to call again interceptor stack

So, please, how do you resolve this case ???
Why having deleted the ServletAction that was in WW ????


-- 

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: mbaroukh@jabber.org
http://www.cardiweb.com
---



Re: [S2] forward to another action

Posted by Mike Baroukh <mb...@cardiweb.com>.
Thanks but It wouldn't work because I call some old code that use 
request.getParameter() and not ActionContext.
finally, all I wan't is just a standard "forward"...

Mike


cilquirm a écrit :
> why can't you add parameters in chain?
>
> In your action, can't you :
>
>  1)  implement ParameterAware
>  2) set a parameter value in the map that's passed in
>  3) chain to your action
>  4) have the value be set in your chained action, via the params interceptor
>
> -a
>
>
>
> Laurie Harper wrote:
>   
>> Mike Baroukh wrote:
>>     
>>> I can't figure how to do this.
>>> Can somebody help me ????
>>>
>>> I wan't to forward an action to another with something like
>>> requestDispatcher("/action.do?param1=value1").forward(req, res);
>>>
>>> - I can't use redirect because I wan't to use the same request scope.
>>> - I can't use chain because chain doesn't allow to add parameters.
>>> - I can't use dispatcher because *.do is mapped to a filter and not a 
>>> servlet. The application server doesn't find servlet to forward to 
>>> (Result in file not found ...)
>>> - I wan't to call again interceptor stack
>>>
>>> So, please, how do you resolve this case ???
>>> Why having deleted the ServletAction that was in WW ????
>>>       
>> So you're using Struts2? Why not just configure the target action in 
>> your action mapping as normal? Roughly,
>>
>>    <action ...>
>>      <result name="blah">/action.do?param1=value1</result>
>>      ...
>>    </action>
>>
>> If 'value1' isn't static, you can use the ${expr} form to resolve it 
>> against the value stack.
>>
>> L.
>>
>>
>> ---------------------------------------------------------------------
>> 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: [S2] forward to another action

Posted by cilquirm <aa...@gmail.com>.
why can't you add parameters in chain?

In your action, can't you :

 1)  implement ParameterAware
 2) set a parameter value in the map that's passed in
 3) chain to your action
 4) have the value be set in your chained action, via the params interceptor

-a



Laurie Harper wrote:
> 
> Mike Baroukh wrote:
>> 
>> I can't figure how to do this.
>> Can somebody help me ????
>> 
>> I wan't to forward an action to another with something like
>> requestDispatcher("/action.do?param1=value1").forward(req, res);
>> 
>> - I can't use redirect because I wan't to use the same request scope.
>> - I can't use chain because chain doesn't allow to add parameters.
>> - I can't use dispatcher because *.do is mapped to a filter and not a 
>> servlet. The application server doesn't find servlet to forward to 
>> (Result in file not found ...)
>> - I wan't to call again interceptor stack
>> 
>> So, please, how do you resolve this case ???
>> Why having deleted the ServletAction that was in WW ????
> 
> So you're using Struts2? Why not just configure the target action in 
> your action mapping as normal? Roughly,
> 
>    <action ...>
>      <result name="blah">/action.do?param1=value1</result>
>      ...
>    </action>
> 
> If 'value1' isn't static, you can use the ${expr} form to resolve it 
> against the value stack.
> 
> L.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/forward-to-another-action-tf3326999.html#a9259840
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [S2] forward to another action

Posted by Mike Baroukh <mb...@cardiweb.com>.
 >Why not just configure the target action in your action mapping as normal?

Does it work for you ? Not for me : 404 Not Found.
And this is, I suppose, because Struts2 use filter instead of servlet.
I also tried by addin <dispatcher>FORWARD</dispatcher> as I saw 
somewhere but still no luck.

But maybe is it with my appserver : Resin. Do you have another result 
with tomcat ?

Mike


Laurie Harper a écrit :
> Mike Baroukh wrote:
>>
>> I can't figure how to do this.
>> Can somebody help me ????
>>
>> I wan't to forward an action to another with something like
>> requestDispatcher("/action.do?param1=value1").forward(req, res);
>>
>> - I can't use redirect because I wan't to use the same request scope.
>> - I can't use chain because chain doesn't allow to add parameters.
>> - I can't use dispatcher because *.do is mapped to a filter and not a 
>> servlet. The application server doesn't find servlet to forward to 
>> (Result in file not found ...)
>> - I wan't to call again interceptor stack
>>
>> So, please, how do you resolve this case ???
>> Why having deleted the ServletAction that was in WW ????
>
> So you're using Struts2? Why not just configure the target action in 
> your action mapping as normal? Roughly,
>
>   <action ...>
>     <result name="blah">/action.do?param1=value1</result>
>     ...
>   </action>
>
> If 'value1' isn't static, you can use the ${expr} form to resolve it 
> against the value stack.
>
> L.
>
>
> ---------------------------------------------------------------------
> 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: [S2] forward to another action

Posted by Laurie Harper <la...@holoweb.net>.
Mike Baroukh wrote:
> 
> I can't figure how to do this.
> Can somebody help me ????
> 
> I wan't to forward an action to another with something like
> requestDispatcher("/action.do?param1=value1").forward(req, res);
> 
> - I can't use redirect because I wan't to use the same request scope.
> - I can't use chain because chain doesn't allow to add parameters.
> - I can't use dispatcher because *.do is mapped to a filter and not a 
> servlet. The application server doesn't find servlet to forward to 
> (Result in file not found ...)
> - I wan't to call again interceptor stack
> 
> So, please, how do you resolve this case ???
> Why having deleted the ServletAction that was in WW ????

So you're using Struts2? Why not just configure the target action in 
your action mapping as normal? Roughly,

   <action ...>
     <result name="blah">/action.do?param1=value1</result>
     ...
   </action>

If 'value1' isn't static, you can use the ${expr} form to resolve it 
against the value stack.

L.


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