File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF beginner error: Cannot find FacesContext Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF beginner error: Cannot find FacesContext" Watch "JSF beginner error: Cannot find FacesContext" New topic

JSF beginner error: Cannot find FacesContext

Leticia Barbalho
Ranch Hand

Joined: Sep 02, 2005
Posts: 37
Hello guys,

I am finding the error "Cannot find FacesContext" while running my JSF webapp. I googled it and found that in most cases the error is regarding web.xml, right? Well I'm posting this because I think that is not my problem.

I start to prepare an application.. and I fix its web.xml and faces-config.xml. I add the necessary libs. Then, I write an index.jsp with only HTML contento on it. It runs ok.
But then if I change this jsp to one that has calls to JSF tags and it gives me the Cannot Find FacesContext error.

Will anyone help? Below go my files:



The simple fact of putting a "<%@ taglib uri="" prefix="f" %>" line in the index.jsp causes the error.
Is it the right line to include? Is the http address correct?

Oh. And I have the following libraries added:
- commons-beanutils.jar
- commons-collections.jar
- commons-digester.jar
- commons-logging.jar
- jsf-api.jar
- jsf-impl.jar
- jstl.jar

Is there something wrong? hehehe
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Can you show the JSP file and also the URL you are using to access the page?


GenRocket - Experts at Building Test Data
Alexander Jesse
Ranch Hand

Joined: Mar 17, 2004
Posts: 35
what URL are you using to call this index.jsp?

If it is "..../index.jsp", then the JSF-lifecycle is not entered, and all JSF-tags cough up.
If it is "..../index.jsf" then the lifecycle is not entered because the web.xml has the not corresponding mapping...

If it is "..../faces/index.jsp" then the lifecycle is entered and therefor the message should not be shown.

[ May 15, 2006: Message edited by: Alexander Jesse ]
I agree. Here's the link:
subject: JSF beginner error: Cannot find FacesContext
It's not a secret anymore!