Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaServerFaces

Status
Not open for further replies.

SuperMoonster

Programmer
Aug 11, 2005
59
BR
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:

web.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="[URL unfurl="true"]http://java.sun.com/xml/ns/j2ee"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xsi:schemaLocation="[URL unfurl="true"]http://java.sun.com/xml/ns/j2ee[/URL] [URL unfurl="true"]http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">[/URL]
    <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config><session-timeout>
            30
        </session-timeout></session-config><welcome-file-list><welcome-file>
            index.jsp
        </welcome-file></welcome-file-list></web-app>

faces-config.xml:
Code:
<?xml version='1.0' encoding='UTF-8'?>
 
 
<!DOCTYPE faces-config PUBLIC
  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
  "[URL unfurl="true"]http://java.sun.com/dtd/web-facesconfig_1_1.dtd">[/URL]
 
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config>
      
</faces-config>


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
thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top