how to use FacesContext in JSF? please give me one whole example ? and some explantion when and at what condition we need to use this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
FacesContextgives you access to multiple useful contexts and objects, like:Applicationobject, containing application-related ‘settings’ServletContextUIViewRootYou obtain it via
FacesContext.getCurrentInstance(). After that – check the docs to see what can be of particular interest to you.The
FacesContextis initialized per each request, andgetCurrentInstance()actually returns aThreadLocalvariable.It is to be noted, that a simple application should be able to work without the need to access the
FacesContext.