Is there an HTTP header or other mechanism to force the browser to change the URL shown in the address bar (
not redirect to a new URL to be loaded)? For example, you click a link with the URL "http://server/servlet?id=10&op=load", the
servlet runs, and when it returns it tells the browser to display "http://server/servlet" as the URL for the page?
It's like client-side redirect since it changes the URL, but it's like server-side redirect (forward) in that it doesn't tell the browser to actually load another URL.
Here's the background:
I have a fairly simple servlet that displays a status screen with operation links when no parameters received. The operation links hit the same servlet, this time with parameters, that tell it what to do. I kept it all as one servlet since it's pretty simple.
Now, when an operation is performed, the work is done and the updated status screen is displayed. However, I want the URL in the browser to be the no-parameter status screen URL so they don't inadvertantly reload the page and perform the operation again. I used a client-side redirect to do this, and it works great.
However, now I'd like to display an error message on the status screen if the operation fails. Since it redirects to the status screen, the message must be stored in the session or elsewhere to save it. I can do this, but it seems far more work than is needed.
Does anyone know a simple solution like I outlined at the start? Thanks!