wood burning stoves 2.0*
The moose likes Struts and the fly likes Session and Map in Struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session and Map in Struts 2" Watch "Session and Map in Struts 2" New topic
Author

Session and Map in Struts 2

Sameer Ahmed
Greenhorn

Joined: Apr 15, 2011
Posts: 11
Hi

I am trying to do following.
1. to store some data(beans, flags etc) that will be used throughout the application (values may change)
what i did is I kept the data in the session but that is making the application to work slowly as there is quite a lot of data.
Someone told me that I can use Map<k,v> but how will the Map persist throught the session ?

please help me...
I want to keep some data persistent throught the session but without storing data in Session Object . Is this possible ?

please let me know....

I am using struts 2
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8838
    
    7

I kept the data in the session but that is making the application to work slowly as there is quite a lot of data.


How have you established that the amount of data in the session is inhibiting performance?
You may want to store the data in a database and only retrieve the data you need for a particular page.





"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Sameer Ahmed
Greenhorn

Joined: Apr 15, 2011
Posts: 11
Actually I want some data to persist as long as session doesnt expire...also for diff session...data will be different, so i cannot store data in the DB.

Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8838
    
    7

You didn't answer my first question, and I don't see why you can't store data in the database given that the life cycle of database data is longer than the life cycle of a session. You just need some way to identify which database record goes with which session.
I've stored data directly on the file system at times, using the user ID as a directory name. This is a good idea when the data is not something that fits well in a typical database, like large images.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session and Map in Struts 2
 
Similar Threads
Struts 2 session writing efficiency / timing
how to set the request Session in Strut2
Regarding JDBC Connection (URGENT)
jsessionid and session tracking
remove session data