File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes PreDestroy callback function in action controller bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "PreDestroy callback function in action controller bean?" Watch "PreDestroy callback function in action controller bean?" New topic
Author

PreDestroy callback function in action controller bean?

Björn Wessman
Greenhorn

Joined: Jun 01, 2009
Posts: 21
Hi!

I have requestScoped controller bean class with various action methods. After each of these action methods have run, I would like to invoke a "generateMessages" method. I could of course just invoke that method at the end of each action method, but was hoping for something more simple. So I looked into the @PostConstruct and @PreDestroy callback annotations. PreDestroy seemed like a perfect match for what I wanted to do, but I wasn't that lucky; The problem is that in my generateMessages method, I try to access the FacesContext, but FacesContext.getCurrentInstance() returns null at this state of the lifecycle.

Does anyone have a suggestion on how I could achieve this kind of behavior?

BR,

Björn
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PreDestroy callback function in action controller bean?
 
Similar Threads
Beginning EJB 3 Application Development: From Novice to Professional - Errata
EJB 3 - lifecycle callback interceptor - should not be final or static?
PostConstruct and PreDestroy methods can be have any access modifier
Confusion between PreDestroy and Remove annotation
@Predestroy and timeout