Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Table navigation

 
Michael Swierczek
Ranch Hand
Posts: 125
1
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on medical test software. You log in, and you have a number of menu choices on the left: Patients, Reports, Clinicians, etc...

Let's say a user clicks Patient, pages through the table to the third set of entries, clicks Reports, and then clicks back on Patient. By default, they get returned to the first page of the Patient table again. It would be much more convenient for them to be returned to the page of Patient they were most recently on.

I have a working solution, but it seems a little awkward and I'd like to see if something more straightforward exists.
Create a session attribute "menu locations" that is a Map. The Map keys are the menu choices, "Patients", "Reports", "Clinicians", etc... The Map values are the most recent HttpServletRequest.getQueryString() values when the user navigated through the corresponding menu. Each time the user clicks a menu item, check the request query string. If it is non-null, simply save it in the session Map and continue normally. If it is null, check the session Map for a value for that menu. If you find one, forward to that location.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,

I don't see anything wrong with your solution. I know we're always our own worse critics, but from my point of view, it doesn't look awkward at all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic