Ok, now that is a pattern I considered, but I don't have experience
with the HttpSessionListener. Has it worked well for you? Is it
flakey? I think I had a bad experience some time ago with session
listeners, but that could have been with .asp pages. Yes, I did .asp
dev once. I needed the money. I am ashamed.
-D
On Apr 8, 2008, at 9:02 AM, Peter Schneider-Manzell wrote:
Hi!
I made something similar in one of my last web apps:
- Store the last 10 pages the user visited in a list in the Session
(By using your interceptor). Make sure that only your max amount of
entries are stored in the list (By replacing the least relevant
entry).
- Implement a HttpSessionListener and add the DB update in this
listener-> Only when the user gets logged out or his session
expires, db updates are triggered by using the list from the session.
Maybe this helps,
Bye,
Peter
2008/4/8, Dustin Pearce <[EMAIL PROTECTED]>:
Hello,
I am having a mental block. I want to create a simple list that
tracks the last 10 records the user visited. I am using Struts2 and
I have implemented an interceptor to capture the id of the object
when the user goes to show().
At this point, I am not sure how I want to, or the best way, to save
this list. I am sure that I want the list to persist across
sessions. My struggle is that I don't want to pollute my model with
web specific data structures, and I didn't want to pollute my pretty
REST controller with User Preference code.
Struts2 interceptors have to be thread safe, so I am worried about
persisting data to the database from there. If I synchronize those
calls I worry I will be causing myself performance trouble.
So........would you......
* Create a UserPreference object and then update the database with
the interceptor each time the "thing" is viewed? The interceptor
would only be run on this specific action method -- show().
* Something else?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]