• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

browser back button problem.

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JSP page in which there are 5 links and 2 Combo box.
When any event(by clicking links or chosing a diffrent value in combo box) is fired on this page, same page is submitted.

On clicking the link the records for that link is displayed (Expanded).
On clickig the link again the expanded record is contracted.

Let me explain with an example (w.r.t to links).

link1
link2
link3
link4
link5

Suppose link2 is clicked.

link1
link2
//Records for link2
link3
link4
link5

link 3 is clicked.

link1
link2
//Records for link2
link3
//Records for link3
link4
link5

If I click the link2 again

link1
link2
link3
//Records for link3
link4
link5

Now when I click the browser back button(from this state).

link1
link2
//Records for link2
link3
//Records for link3
link4
link5

Now the problem is when I click the link5
I get this

link1
link2
link3
//Records for link3
link4
link5
//Records for link5

but It should be


link1
link2
//Records for link2
link3
//Records for link3
link4
link5
//Records for link5


To explain briefly about the code.
On clicking the link, I call a javascript. In the javascript
based on the link clicked I set the flag to expanded(if it is normal)/ contracted (if the link is in expanded mode).
There are flags corresponding to each links.


Can anyone help me?

Thanks in Advance
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whenever you click a link a new request is send to the server. But when you use a Back browser Button your cached page is displayed to you(It doesn't reflect the current state of your application).It's just a stale page. Thats why you expected Records for link2 it was NOT available.
 
Vaithialingam Asai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for information.

I will be happy If you can tell me how can I handle this situation.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You CANNOT control users using Back browser Button. That can't be done from server-side code. you can control such operations using JavaScript. Search this forum and servlet forum for code samples.
 
I knew that guy would be trouble! Thanks tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic