0

Let's say there is a int x = 10 in the session, when I click a link, I change it's value to x++ in the link click event.

Is there a way, in which, if I hit the browser back button, the session will be restored back to the previous version. Meaning, in this case, x's value will be 10, which is the initial value.

Soumitri Pattnaik
  • 3,246
  • 4
  • 24
  • 42

2 Answers2

0

You are talking about history, not different sessions. History is usually implemented with history tokens. Check out this guide for GWT: http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsHistory.html

Robert Mugattarov
  • 1,278
  • 2
  • 12
  • 26
0

Put such kind of data in Wicket component, like the Page, instead of in the http/Wicket session.

martin-g
  • 17,243
  • 2
  • 23
  • 35
  • it won't work that way. I just gave you an example there. In real I have all kinds of flags in my session, which indicates the current report and stuffs like that. For example : If you click a certain link, I set a flag's value to a certain value, based on which I populate the date on the page. Let's say, I clicked a similar link, then hit the back button, then went ahead clicked on another link, it ll actually show the wrong data as the flag's value is wrong. – Soumitri Pattnaik Jul 14 '15 at 13:21
  • By going back in history you will use an old version of the page, i.e. the flag will have its older value too. When modifying such flag make sure you mark the page as dirty (`Page#dirty(false)`) so that a new version of it is stored. Usually Wicket does this automatically for you but there are times when you need to be explicit. – martin-g Jul 14 '15 at 17:25
  • I have tried checking the flag values, they don't retain their older value. – Soumitri Pattnaik Jul 14 '15 at 18:21