Persisting J2EE Web App State
I'm looking for thoughts based upon experience of how best to persist the state of a browser-based application in J2EE. The sort of scenario I'm thinking about is taking the user back to the screen they were viewing when they last logged on, that sort of thing. Would this be a job for an LDAP-compliant directory service?
Are cookies an option?
Probably but would only want to store the bare minimum of information in a cookie, such as a user ID.
If they had to log in first, you could store it server side.
Where? Er, the database?
You could do it in LDAP but this is not a preferred use for such a directory. In general you want to use LDAP for user info which tends not to change over time. The one example you give would change every session.
Every JSP Servlet ... has a session object (a hashmap)store the relevant info there!
meant to say JSP/Servlet
Also look at struts
A session object is no good, as it goes away when the session is over. LDAP is a poor choice, see above, and cookies are really useful only for very small snippets of data.
Try this, give everyone a session id, have an object implement serializable and write session out to disk.
oops didn't read your post will, yep method three sounds good,
Good point-- you can't depend on logout. But there's several ways to get around this.
Fog Creek Home