Jason Hunter wrote:
> > > Simple question .. In asp, there's a response.end .. which
> > > terminates the activity of the ASP page. Is there an equivalent,
> > > or do I just EXIT (0);
> > >
> > > Hoping there's a cleaner way!
> >
> > By default, you don't need to do anything at all. At the end of
> > your JSP page, the generated code flushes the output stream for you,
> > and gets ready for the next request.
> >
> > If you want to terminate the output at a particular point, the
> > simplest way would be with a Java Scriptlet like this:
> >
> > <%
> > out.flush();
> > return;
> > %>
>
> In some situations this doesn't suffice. For example, when you call a
> utility class to generate your page and that class decides it need to do
> a redirect. There's no easy way for it to say "we're done here, no more
> output".
>
If you pass the response object to your class's method as an argument, you
can call sendRedirect() from there just as easily as you can from the
servlet class.
>
> Picture you're writing a class to detect if the client supports
> cookies. In ASP, the utility could do the work without bothering the
> programmer. How it works is first thing in your page, ask the utility
> getCookieSupported(). If the utility doesn't know the answer, it does a
> redirect (with a test cookie) to check and calls response.end. The ASP
> caller never knows control was taken away. But the next time the client
> visits the ASP page the getCookieSupported() call returns a valid true
> or false. Snazzy, but not possible in JSP near as I can tell.
>
> Seems a limitation of a stack-based language. Best you could do is set
> a flag to have future response output ignored.
>
None of this has enough value for me to even consider using a
non-stack-based language :-). It's hard enough to debug stack-based
applications, without the totally arbitrary flow-of-control issues you've
got with the kind of freedom required to pull this off.
>
> -jh-
>
Craig McClanahan
===========================================================================
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