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".
>
> 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.
Actually in JSP 1.1 you can do this with custom tags (added in the PR1 version
of the spec). A tag can return a value from the doEndTag method that tells the
JSP engine to flush the stream and return. It's all hidden from the user of the
custom tag.
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
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