struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <>
Subject Re: action forward to servlet
Date Mon, 30 Apr 2007 17:42:08 GMT
The first question should be, do you really need the servlet? You could 
generate the full response from the action. If you still need to keep 
the servlet around for other uses, perhaps you can refactor the bulk of 
its work into a service class that both the servlet and the action can 
use to generate the response.

Failing that, the way to do this is to manually dispatch to the servlet 
(using request.getDispatcher("/servlet/path").forward() or something 
like that; I forget the exact API). Then be sure to return 'null' from 
your action to tell Struts it shouldn't do anything further with the 



Felipe Rodrigues wrote:
> Preserver de session?
> Session is already preserved. Did you try that?
> To get values from session in your servlet you must use Session ses =
> request.getSession().
> Than you have your session object. Parameters from request? You should use
> request.getParameters().
> To get Action fields, well I'm not sure what struts you're using, but maybe
> you can use ActionContext class to get that.
> Regards,
> Felipe
> cpanon wrote:
>> Hello
>> Is/how it possible to forward from a action to a servlet at another url
>> and preserve the parameters and session objects?  I am doing all the
>> processing in the Action and just simply need to send a data stream back. 
>> I can do it with servlets, but cant seem to do it with an action and a
>> servlet.  Can someone help me understand?  tia.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message