> The drawback I've found with the forward() method is that since
> there is no
> real redirect happening (but saving us the extra round trip) is
> that the url
> displayed for the forwarded page is really the URL of the initial
> page that
> was called.
>
> This can backfire on you and your users in the following situation:
>
> Your login page has a form with ACTION="/servlet/LoginServlet". When the
> user submits the form, the user's browser goes to the page
> "/servlet/LoginServlet". The servlet does it's work, and forwards to some
> other page, let's say your main menu page, but the user still sees the url
> of "/servlet/LoginServlet". So if they were to bookmark this new page,
> they'd really be bookmarking the servlet.
I faced a similar issue. Now, instead of using:
ACTION="/servlet/LoginServlet"
I'm using
ACTION="/servlet/LoginServlet/<%= redirectPage %>"
then my servlet looks like:
protected void doPost(
HttpServletRequest req,
HttpServletResponse resp) {
...
String redirectPage = req.getPathInfo();
...
getServletConfig().getServletContext(
).getRequestDispatcher(
redirectPage).forward(req, resp);
}
===========================================================================
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".