>>> Rick L Sample <[EMAIL PROTECTED]> 10-Feb-00 7:22:12 PM >>>

This:
...
    if (session == null) {
      res.sendRedirect("http://localhost:8080/error.html");
    }
...

is an HTTP redirect, here's what happens:

1. the server sends a redirect response (temporary or permanent) to
the browser
2. the browser sends another request to the location specified by the
redirect response

ie: there are at least 2 network trips to retrieve the URL


>as opposed to:
...
      String url="/jsp/shopping/EShop.jsp";
      ServletContext sc = getServletContext();
      RequestDispatcher rd = sc.getRequestDispatcher(url);
      rd.forward(req, res);
...

is programmatic, it occurs *within* the servlet engine and therefore
does not cause any network traffic.

In essence you should only use HTTP redirects for redirecting, which
is not the same as forwarding a request.



Nic Ferrier

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to