This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
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 Introducing JavaFX 8 Programming this week in the JavaFX 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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why does FacesContext .getCurrentInstance() return null?
 
jQuery in Action, 3rd edition