Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Cannot find FacesContext

  Asked By: Caleb    Date: Sep 11    Category: Java    Views: 1319

while executing JSF page iam getting this error....

javax.servlet.ServletException: Cannot find FacesContext
whats the solution to this error?



1 Answer Found

Answer #1    Answered By: Aalia Arain     Answered On: Sep 11

you should inject FacesContext in your java code with annotation

@In(required = true)
private FacesContext facesContext;

and your import should be :
import javax.faces.context.FacesContext;
if it is not work you should findout what is your problem and often with create new facesContext solve this problem
FacesContext facesContext = new FacesContext();

Didn't find what you were looking for? Find more on Cannot find FacesContext Or get search suggestion and latest updates.