request.sendRedirect or javascript: document.location.replace()
843840May 17 2002 — edited May 18 2002We are developing JSP projects on WAS3.5. We are not using J2EE or XML. We are currently using all JSP's in our projects without the use of servlets. When we need to redirect to a different page, we use:
<script language="JavaScript1.2">
<!-- Begin
top.document.location.replace('LoginAgain.jsp');
// End -->
</script>
We have begun looking into using servlets instead of this approach. What is the difference in using the above technique and using sendRedirect? In a previous post from 5/17/2002, markkid explains that sendRedirect uses the following approach: server->browser->server->browser. Is this more efficient than the document.location.replace described above?
Would you recommend continuing in our current approach or switching to use servlets? Please explain.
Thanks in advance.