Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session and Map in Struts 2

 
Sameer Ahmed
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9320
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.




 
Sameer Ahmed
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9320
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic