Apologies in advance for the long post, but I have a question for the
group about best practices for handling application state in Lift. By
way of  background, our team members are Lift newbies but have been
building web applications for well over a decade, using many different
languages and frameworks.

The application that we are developing has a tabbed user experience.
The tab usage is somewhat different from the norm in that, instead of
representing a choice from fixed set of categories, each tab
represents a complex record from our application's database (think a
case file). Within each tab the same pages appear, but with the data
on the pages focused around a the currently selected case. Users
create/destroy tabs as they use the application. An analogy might be
the use of Worksheets within Excel files.

We have been using a SessionVar to store the IDs of the cases that the
user has opened as tabs, as well as the ID currently selected case.
And the following scenario has cropped up:

User selects tab A, visits pages 1, 2, 3.
User selects tab B and visits page 1 (but this time in the context of
record B)
User clicks "back" and sees page A 3.

At this point the state of the application is out of sync with the
page the user is seeing.  Because the SessionVar holding the id of the
current case ID is "B", clicking on any of the links on this page will
display unexpected data (relative to "B" rather than the "A" that
appears on the screen).

Obviously this situation is as old as the web itself and isn't unique
to Lift. In the past we would have baked these IDs into the page
itself as form parameters and passed them around as query strings on
links.  However, I was wondering if there is a more idiomatic, Lift-
like way of maintaining this kind of state. Certainly we could resort
to the old techniques of passing this around from page to page, but it
seems at odds with the stateful nature of Lift. And given our relative
inexperience with the framework, we wanted to reach out and see if
there is a better way of handling this before we proceed.

Any advice appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to