You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Phillip Rhodes <ph...@rhoderunner.com> on 2001/03/22 05:11:13 UTC

From action class perform straight to servlet?

In the action class  perform method, there is a return type of a 
ActionForward object.

But I want to go straight to a servlet  in this method (FOP, generating a 
PDF).  (Wondering, can ActionForwards refer to servlets?)

I know I can return a ActionForward object that points to to a jsp that 
would include the servlet, but this seems wrong.  Can someone tell me what 
would be the best way to go from ActionForward perform method straight to a 
servlet?


Thanks!!!
Phillip


Re: From action class perform straight to servlet?

Posted by Nick Pellow <ni...@cortexebusiness.com.au>.

Phillip Rhodes wrote:
> 
> In the action class  perform method, there is a return type of a
> ActionForward object.
> 
> But I want to go straight to a servlet  in this method (FOP, generating a
> PDF).  (Wondering, can ActionForwards refer to servlets?)
> 
> I know I can return a ActionForward object that points to to a jsp that
> would include the servlet, but this seems wrong.  Can someone tell me what
> would be the best way to go from ActionForward perform method straight to a
> servlet?

Define a forward such as, 

<forward name="login.success"              path="/create"/>

where create is an action like:

 <action    path="/create"
            type="com.cortexeb.taglib.cortrack.CreateAction">
 </action>

Cheers, 
Nick

> 
> Thanks!!!
> Phillip

Re: From action class perform straight to servlet?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 21 Mar 2001, Phillip Rhodes wrote:

> In the action class  perform method, there is a return type of a 
> ActionForward object.
> 
> But I want to go straight to a servlet  in this method (FOP, generating a 
> PDF).  (Wondering, can ActionForwards refer to servlets?)
> 
> I know I can return a ActionForward object that points to to a jsp that 
> would include the servlet, but this seems wrong.  Can someone tell me what 
> would be the best way to go from ActionForward perform method straight to a 
> servlet?
> 

Yes, you can do this.  The path you define in your forward element is
anything that a RequestDispatcher.forward() call can execute, which
includes any mapping to a servlet that you have defined.

You might also want to consider a feature that was added in the last week
or so -- you can now define an <action> that does a forward or include
(instead of calling your Action class) after doing the form bean
processing.  This can be a useful technique for integration with
functionality that is already available in a servlet (such as FOP) but
where you don't need any processing other than capturing the form bean
properties.

> 
> Thanks!!!
> Phillip
> 
> 

Craig