John Raley wrote:

> Right now I'm "forwarding" to a JSP that does nothing but redirects to the
> URL I want them to see (basically what you said).  I would love to hear
> better solutions as well.
>

The technical reason this happens is that RequestDispatcher.forward() (or
<jsp:forward>) happens only on the server side -- the browser has no clue what
is going on, and only displays the URL it submitted to -- not the URL of the
page you called to create the response.

In various apps I have taken the following approaches to this issue:

* Tell my users "deal with it -- this is a web application, not a
  web site, and the URL that you see is totally irrelevant."  Of
  course, it is incumbent upon the page designer to ensure that
  there are always enough navigation controls that the user does
  not feel tempted to use the back and forward arrows or bookmarks
  within your app.

* Use a framed presentation with only one frame in it -- that way,
  the location bar never changes so the user isn't distracted.

* Open your application in a window that does not have a location
  bar, so the user isn't distracted.

If you can get away with it, I prefer the first approach :-).

Craig


>
> Bear wrote:
>
> > I'm just in the process of re-vamping my web app to use the Struts
> > framework (moving from a Model 1 to a Model 2 architecture) and have come
> > across what I see as a fundamental problem that I'm sure is just something
> > I must be missing.
> >
> > The result of an action submission from a form is obviously a post
> > operation. When the resulting JSP page shows the result of the action, the
> > URL still shows the "command.do" form of the URL. That's not the problem
> > though. If the user then refreshes the page, he/she gets the "do you want
> > to repost" message (annoying), but worse, the post operation is
> > resubmitted. For a destructive operation (like a delete) this could cause
> > lots of problems for my app.
> >
> > Aside from forcing the ActionForward to be a redirect rather than a
> > forward, how have y'all handled this situation?
> >
> > thanks,
> > bear

Reply via email to