The main difference that I know of is that sendRedirect is more network
intensive because it forces a roundtrip. Basically, if you send back a
redirect, you are doing 3x the work..because you send a response back, which
tells the browser to send another request to the server, which then sends
back another response. A forward bypasses all this by just jumping from one
page to the next to send back as the response, without having to go to the
browser first to request that page. The only downside that I know of with
forwarding is the web browser url may not reflect the actual page returned.
If you go to page1.jsp, and on the server it forwards to page2.jsp, the
result you'll see in the browser is page2.jsp, but the url still says
page1.jsp. A redirect does update this. At the cost of an extra to/from trip
that redirects do, I would much rather decrease my traffic load by 3x and
use forwarding and not worry about what the url line says in the browser.
Besides, if you think of it in terms of a web application, once the user
gets to your site, the url line shouldn't be used any longer as they should
be navigating the site via links, buttons, etc. I like to use a 2-frame
approach myself. First, it makes sure the url always says the same thing
(most likely the www.mycompany.com), and second, it allows me to put
javascript and what not in the "hidden" frame that no longer needs to be
downloaded with every page. As an added bonus, bookmarking always bookmarks
the main site page. The one downside I can think of with this approach is if
the user hits refresh, it takes them back to the main page. This is
especially troublesome for those that use logins..a refresh effectively logs
them out (or so it seems..the server side still may keep them logged in).
> -----Original Message-----
> From: Shahed A Moolji [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 23, 2001 1:08 PM
> To: [EMAIL PROTECTED]
> Subject: KeepAlive and sendRedirect Vs jsp:forward
>
>
> Hi,
>
> I am using TC 3.2.1 w/Apache and ajp13 - JDK 1.3.1 Solaris 8 Sparc
>
> If I have keepalive turned on in apache, my
> response.sendRedirect() dont
> seem to work well.
>
> However <jsp:forward> seems to work.
>
> What is the difference from the point of view of the browser
> between the 2 ?
>
> Thanks
> Shahed
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets