0 Replies Latest reply on Apr 13, 2008 1:07 PM by Sara Rodríguez Dorrego

    Cannot find FacesContext

    Sara Rodríguez Dorrego Novice

      Hello!

      I've a doubt ... Why the index.jspx can't contain any jsf tag like <h:commandButton/> or similar? The error that it's thrown is:

      javax.servlet.jsp.JspException: Cannot find FacesContext
      javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:399)
      com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:105)
      org.apache.jsp.index_jsp._jspx_meth_f_view_0(index_jsp.java:84)
      org.apache.jsp.index_jsp._jspService(index_jsp.java:60)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      


      But, If I put the index.faces in the browser I could see perfectly the page.

      In my web.xml I have:

      <welcome-file-list>
       <welcome-file>index.jspx</welcome-file>
       </welcome-file-list>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>0</load-on-startup>
       </servlet>
      
       <!-- Faces Servlet Mapping -->
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.faces</url-pattern>
       </servlet-mapping>
      
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.jspx</param-value>
       </context-param>
      


      I've solucionated this, using the <jsp:foward> tag that redirect to other pages in which I could use the jsf tags. But what is the reason for that? The Faces context load is lazy? Is there any other solution for that issue?

      Thanks