You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Katherine Barry <kb...@SS8.com> on 2001/03/06 15:07:22 UTC

Action forwards

We are using action forwards, but the url in the browser never changes.
Everything works happily, so the only thing we want is for the browser to
change and display the new URL(mainly for the refresh button). I know
everyone is now using 1.0, but we haven't migrated, and are still using
0.5(we are to close to release to have changed). How can I get the browser
to update?

Katherine


RE: Action forwards

Posted by Katherine Barry <kb...@SS8.com>.
We are have a side-menu so generally it hasn't been a problem. What we do
care about is the refresh. We would like to be able to use it, but it goes
back to the original page forces us to log back in. If we live with
forwards, can we get the refresh to work?

Thanks.

Katherine

-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: Tuesday, March 06, 2001 10:03 AM
To: struts-user@jakarta.apache.org
Subject: Re: Action forwards


Katherine Barry wrote:

> We are using action forwards, but the url in the browser never changes.
> Everything works happily, so the only thing we want is for the browser to
> change and display the new URL(mainly for the refresh button). I know
> everyone is now using 1.0, but we haven't migrated, and are still using
> 0.5(we are to close to release to have changed). How can I get the browser
> to update?
>

What you are seeing is the result of how a RequestDispatcher.forward()
works.
This all happens on the server side, and the client browser has no clue what
happened.  The only way to get the browser's displayed URL to change would
be
to use redirects instead of forwards, which has two disadvantages:

* It is much slower, because of the extra round trip to the browser

* It eliminates the ability to use request attributes, because the redirect
  comes in as a separate request.

As I general rule, I train my users to totally ignore the location bar when
running a web application (as opposed to surfing a web site).  If they still
get confused, you have several options:

* Run inside a framed presentation so that the location bar
  *never* changes.

* Use JavaScript to create a new window that has no location
  bar, and run your app inside that.

* Get some new users (don't we wish sometimes :-).


> Katherine

Craig


Re: Action forwards

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Katherine Barry wrote:

> We are using action forwards, but the url in the browser never changes.
> Everything works happily, so the only thing we want is for the browser to
> change and display the new URL(mainly for the refresh button). I know
> everyone is now using 1.0, but we haven't migrated, and are still using
> 0.5(we are to close to release to have changed). How can I get the browser
> to update?
>

What you are seeing is the result of how a RequestDispatcher.forward() works.
This all happens on the server side, and the client browser has no clue what
happened.  The only way to get the browser's displayed URL to change would be
to use redirects instead of forwards, which has two disadvantages:

* It is much slower, because of the extra round trip to the browser

* It eliminates the ability to use request attributes, because the redirect
  comes in as a separate request.

As I general rule, I train my users to totally ignore the location bar when
running a web application (as opposed to surfing a web site).  If they still
get confused, you have several options:

* Run inside a framed presentation so that the location bar
  *never* changes.

* Use JavaScript to create a new window that has no location
  bar, and run your app inside that.

* Get some new users (don't we wish sometimes :-).


> Katherine

Craig



Re: Action forwards

Posted by Ted Husted <ne...@husted.com>.
Katherine Barry wrote:
> We are using action forwards, but the url in the browser never changes.
> Everything works happily, so the only thing we want is for the browser to
> change and display the new URL(mainly for the refresh button).

I believe Refresh repeats the last request, rather than the URL that
appears in the browser's address window. 

If you want refresh to redisplay the current page (without repeating the
last request, which may include input from a form), then you should use
the redirect technique that Craig mentioned. (In which case generating a
new request becomes a benefit rather than a drawback.)

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/