On Tue, 13 Aug 2002 [EMAIL PROTECTED] wrote:
> Date: Tue, 13 Aug 2002 16:36:01 -0400
> From: [EMAIL PROTECTED]
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Forwarding response from Action class to another servlet
>
> Newbie to struts so bear with me...
>
> Is there a way to forward a response from an action class to another
> servlet instead of a jsp? Does the forward tag only work if you are
> forwarding responses to jsp's?
>
> For example, I'd like to forward the response from my Action class
> ViewPODocumentAction to the PODocumentView servlet which would produce the
> html (thru XSLT).
>
> <action path="/viewPODocument"
> type="com.canopyint.app.rsvp.actions.ViewPODocumentAction"
> input="/listPOInfo.jsp"
> name="poDocumentForm"
> scope="request">
> <forward name="success" path
> ="com.canopyint.app.rsvp.views.PODocumentView"/>
> </action>
>
Deep down inside, Struts is doing a RequestDispatcher.forward() call to a
context-relative path that starts with "/". So, the "path" attribute of
your forward must match a <servlet-mapping> in the web.xml file for the
servlet you want to execute. JSP pages work by default because there is a
"*.jsp" mapping to the JSP page compiler servlet already defined.
See the Servlet Spec (especially chapter 11) for more details.
http://java.sun.com/products/servlet/download.html
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>