aspose file tools
The moose likes JSF and the fly likes Why does FacesContext .getCurrentInstance() return null? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Why does FacesContext .getCurrentInstance() return null?" Watch "Why does FacesContext .getCurrentInstance() return null?" New topic
Author

Why does FacesContext .getCurrentInstance() return null?

Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
I have a servlet (several actually) in a JSF application that I need to gain access to the FacesContext in.

I noticed that often when I call FacesContext .getCurrentInstance() it will return null.

Now, it is my understanding that as long as a JSF page within my application had been called previously, then the FacesContext should have been set up. Is this not the case?

Any clues as to why the context is null?

This is driving my nuts!
[ December 02, 2005: Message edited by: Darrin Smith ]
 
jQuery in Action, 2nd edition
 
subject: Why does FacesContext .getCurrentInstance() return null?