Srinivas M wrote:

> Hi All,
>
> Could any body please explain the difference between the functions
> sendRedirect() and callPage().
> Both of these functions are used to redirect the browser request from
> the servlet to JSP.
>
> Thanks,
> Srinivas

First, a clarification -- the callPage() function from JSP 0.91 was replaced
by <jsp:forward> in JSP 1.0.  In 1.0, there is also a <jsp:include> function
that essentially does server-side-includes of other JSP pages.

The key difference is that sendRedirect() sends a redirection back to the
client browser, saying "go here instead".  A <jsp:forward> happens on the
server side, without the extra round trip, so it will be faster.

A second difference is that, with <jsp:forward>, you can pass attributes
specific to this request along with it by using beans with a "request"
lifetime.  If you use sendRedirect, you have to store such things in a
session, or use  some other sort of storage mechanism, instead.

Craig McClanahan

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to