I understand that all methods should return, but in that case, is it
legitimate for the forwarding servlet/jsp
to write to the output stream after the method returns? I know that nothing
can be committed to the output
stream prior to performing a forward, but what about after the return? As
far as I have seen (it may be a matter
of not having seen enough), there is nothing in the servlet or jsp
specification that forbids this....
-AMT
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Ray Cromwell
> Sent: Friday, July 10, 2893 5:44 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Problem with request dispatching
>
>
> > Kevin Jones wrote:
> > > Wrong on both counts I'm afraid - the call can be forwarded
> to a resource,
> > > whcih will typically be a servlet or a JSP, and the call will
> return to
> > you.
> > > You typically put a <code>return;</code> statement after the
> > > RequestDispatcher call,
>
>
> > "Unlike the include() method, control will never return to
> the servlet
> > that forwards the request. The forward() method passes all
> control to the
> > delegate servlet which..."
>
> These semantics are impossible to achieve in Java. A method in Java must
> return. When you call forward(), at some point, that function will
> return to the calling frame. Other languages, like some C
> compilers support
> volatile functions, or the ability to specify that a method call
> should not
> return. (equivalent to a branch/jmp in assembly code. Or, if you like
> BASIC, it's GOTO vs GOSUB)
>
>
> About the only trick I can think of to avoid returning control is to throw
> a RuntimeException and hope that the servlet/JSP doesn't handle it.
>
> -Ray
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html