Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reinitializing session scoped JSF objects?

 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Java object that has a method called when a application starts up. It has an error handling list that I want to reinitilaize each time the main page is accessed.

The method gets called and then the page is shown. For some reason, if I make the object request scope, the page can't see it. Looks like JSF makes a new request object when you forward a page.

I tried calling session.removeAttribute\Add but it does not work. Any ideas?
[ August 04, 2008: Message edited by: M Burke ]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18165
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By definition, request-scope objects are created for each HTTP request and destroyed after the request has been processed.

For something that's initialized once and kept for the life of the application (common to all users), put the item under application scope.

I do this for things like drop-down menu lists that come from databases so I don't have to reload from the database every time someone needs it.
 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice, Tim
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic