File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 397
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: 17410

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.

An IDE is no substitute for an Intelligent Developer.
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 397
Thanks for the advice, Tim
I agree. Here's the link:
subject: Reinitializing session scoped JSF objects?
It's not a secret anymore!