wood burning stoves 2.0*
The moose likes JSF and the fly likes Reinitializing session scoped JSF objects? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Reinitializing session scoped JSF objects?" Watch "Reinitializing session scoped JSF objects?" New topic

Reinitializing session scoped JSF objects?

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
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

Joined: Jun 25, 2001
Posts: 15957

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.

Customer surveys are for companies who didn't pay proper attention to begin with.
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
Thanks for the advice, Tim
I agree. Here's the link: http://aspose.com/file-tools
subject: Reinitializing session scoped JSF objects?
Similar Threads
button or link action not executed inside dataTable
Action method calls when refreshing the JSF page
Change component attributes at RENDER_RESPONSE
Two clients, same button. Only the first one wins?
JSF Basic model question :-(