Problems when using back button in explorer

R

rollo

On a JSP i have a select box with a onchange to submit the page, and
depending on the value selected i retrieve different data to display
ont the same page.

This is how the problem occures: When i first open the page i have
value A as selected and shown in the select box. Now i select value B
and the reload works just fine. Then i press the back button in my
explorer. The select box shows the value B but it i want it to show
value A. If i look att the source, value A is selected wich i correct.

Does anyone have a clue of how to solve this problem?
Or the problem could be solved by somehow getting the information that
the user has pressed back button and then redirect..., is there a way
to do either?

Thanks...
 
A

Anton Spaans

rollo said:
On a JSP i have a select box with a onchange to submit the page, and
depending on the value selected i retrieve different data to display
ont the same page.

This is how the problem occures: When i first open the page i have
value A as selected and shown in the select box. Now i select value B
and the reload works just fine. Then i press the back button in my
explorer. The select box shows the value B but it i want it to show
value A. If i look att the source, value A is selected wich i correct.

Does anyone have a clue of how to solve this problem?
Or the problem could be solved by somehow getting the information that
the user has pressed back button and then redirect..., is there a way
to do either?

Thanks...

Welcome to the world of browsers. :)
This problem is a 'feature'. When you go back to your previous screen
(back-button), the browser will show you the most recent contents of that
screen, just before you left it. That means that your 'B' selection will be
shown (was selected, just before you left the preivious page) and not 'A'.

A way around is (and i can not be sure whether this works because the
browser may still recognize it as a 'previous' page) to make the page expire
immediately. When the page is to expire immediately, the browser will not
load it from its cache but request a fresh one from the web-server. This
will show 'A' selected, since the browser-source specified it as such. But
then, every 'reload/refresh' will show the 'A' selection as well, never the
'B' selection....

If you want better dynamic control, write you own JSP/Servlet to handle the
page-submits and discourage the use of the reload/back/forward buttons (they
can really mess things up in web-applications).

-- Anton.
 
R

rollo

Thank you Anton.

That was exacly what i did since there seemes to be no other solusion.
The expiration forces the user to refresh the page.

To bad for me the customer wants to use the back button. But good for
me is that refreshing the page is ok by them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top