I can't really elaborate further, but I'll try to explain it again.

When you use ResourceDispatcher.forward(), the forwarding occurs on the
webserver, not on the client browser, so the user's browser's url that is
displayed does not change.

Written out:

User gets login screen
        Displayed URL: /login.html
User clicks on submit button on form, with ACTION="/servlet/LoginServlet"
        Displayed URL: /servlet/LoginServlet
LoginServlet does some work, then uses forward() to display "/mainmenu.html"
        Displayed URL: /servlet/LoginServlet (doesn't change!)
User bookmarks new page - URL stored is still "/servlet/LoginServlet", not
"/mainmenu.html"

As I said, the redirection occurs on the server, the the URL visible to the
user says one thing, but the displayed page is another, with confusion
possible if the user stores the displayed URL but really wants the displayed
page.

As Craig McClanahan pointed out in a reply, you can work around this in
several ways, some of which require a smarter servlet.

So this isn't a HUGE drawback or a henious error, it's just something to
watch out for from the user's point of view.

> -----Original Message-----
> From: A mailing list about Java Server Pages specification
> and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Gabriel Wong
> Sent: Wednesday, March 24, 1999 7:23 PM
> To: [EMAIL PROTECTED]
> Subject: Re: getting access to HttpServletResponse
>
>
> Taggart,
>
> Could you please elaborate.  I am having a hard time understanding the
> drawback here...
>
> Gabriel Wong
> http://www.ezwebtools.com
> -------------------------
>
> Taggart Gorman wrote:
> >
> > > -----Original Message-----
> > > From: A mailing list about Java Server Pages specification
> > > and reference
> > > [mailto:[EMAIL PROTECTED]]On Behalf Of Craig R. McClanahan
> > > Sent: Wednesday, March 24, 1999 5:36 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: getting access to HttpServletResponse
> > >
> > [...]
> >
> > > The "forwarding" is done by using the
> > > ResourceDispatcher.forward() method (in
> > > the 0.92 reference implementation).  When released under the
> > > 2.1 servlet API,
> > > this call will become RequestDispatcher.forward() instead,
> > > but it accomplishs
> > > the same purpose.  It acts a little like a redirect, except
> > > there is no extra
> > > round trip to the browser and thus no performance impact.
> >
> > 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.
> > So then you'd need to write code in the servlet to handle
> this possibility
> > and blah, blah, blah.  I've taken to avoiding servlets and
> forward() all
> > together to avoid this.
> >
> >
> ==============================================================
> =============
> > 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".
>
> ==============================================================
> =============
> 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".
>

===========================================================================
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