aspose file tools*
The moose likes Struts and the fly likes Getting instance of FacesContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting instance of FacesContext" Watch "Getting instance of FacesContext" New topic
Author

Getting instance of FacesContext

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Does anyone know if I can and if so how to get an instance of the FacesContext in one of my JavaBeans?
Validation seems to send the FacesContext as an argument, but I need to get this outside of the validation is that is possible.
Thanks.


GenRocket - Experts at Building Test Data
David Parry
Greenhorn

Joined: Dec 14, 2004
Posts: 1
FacesContext.getCurrentInstance().
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by David Parry:
FacesContext.getCurrentInstance().


Gregg,
The method mentioned by Dave is a good way to get an instance of the FacesContext in one of your JavaBeans. Since that method is a static method of FacesContext class itself, you can get the current instance outside of the validation.

FacesContext.getCurrentInstance() is used to return the FacesContext instance from the HTTP request, which is being processed by the current thread of the application.

Hope it helps...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

I figured all this out a long time ago. I guess I should remember to update my old posts when I do solve them. Oops. Thanks for the answers anyway.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting instance of FacesContext