aspose file tools*
The moose likes JSF and the fly likes FacesContext and Servlet 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 "FacesContext and Servlet" Watch "FacesContext and Servlet" New topic
Author

FacesContext and Servlet

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Hi All,

In a web-app i am using JSF and also there is servlet .

Will i be able to access FacesContext in Servlet?


Regards,
Gaurav
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

Kumar Gaurav wrote:Hi All,

In a web-app i am using JSF and also there is servlet .

Will i be able to access FacesContext in Servlet?



No. FaceContext is not a durable object. It is constructed by the FacesServlet and discarded once the FacesServlet is done processing. Since 2 servlets can't be running at the same time, you can't access FacesContext in any other servlet.

However, you don't necessarily need the FacesContext. A lot of people think that the FacesContext holds the backing beans. They're wrong. When a backing bean is in session scope, it's just like any other session-scope bean and the J2EE standard attribute access methods can be used to locate it. Likewise for request and application scopes.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FacesContext and Servlet
 
Similar Threads
How to call JSF backing bean method from the Applet
Accessing the JSF UIViewRoot from a servlet filter??
how we forward a JSF page into Servlet
Asynchronous javascript calls
Can we Access FacesContext outside FacesServlet