Hi All,
I am Pankaj and I am new to learning JSF Applications .
I need some help regarding the following error that i encounter when running index.jsp file of a timezone application
The error that I am getting is :
__________________________________________________ ____________________________________
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 5
2: <%@ taglib uri="http://java.sun.com/jsf/core" prefix = "fa" %>
3: <%@ taglib uri="http://java.sun.com/jsf/html" prefix = "ha" %>
4:
5: <fa:view>
6: <head>
7: <title>The timezone application</title>
8: </head>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
root cause
java.lang.RuntimeException: Cannot find FacesContext
javax.faces.webapp.UIComponentClassicTagBase.getFa cesContext(UIComponentClassicTagBase.java:1855)
javax.faces.webapp.UIComponentClassicTagBase.setJs pId(UIComponentClassicTagBase.java:1672)
org.apache.jsp.index_jsp._jspx_meth_fa_005fview_00 5f0(index_jsp.java:99)
org.apache.jsp.index_jsp._jspService(index_jsp.jav a:73)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
__________________________________________________ ____________________________________
My index.jsp file source Code :
__________________________________________________ ________________________________________
<html>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix = "fa" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix = "ha" %>
<fa:view>
<head>
<title>The timezone application</title>
</head>
<body>
<ha:form>
<p>
The current date and time in
<ha: outputText value = "#{zone.city}"/>
is:
<ha: outputText value = "#{zone.time}"/>
</p>
<p>
Set time zone:
<ha:inputText value = "#{zone.city}"/>
</p>
<p>
<ha:commandButton value = "Submit"/>
</p>
</ha:form>
</body>
</fa:view>
__________________________________________________ _____________________________________
My faces-config.xml file:
__________________________________________________ _____________________________________
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>zone</managed-bean-name>
<managed-bean-class>bigjava.TimeZoneBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>city</property-name>
<value>Los Angeles</value>
</managed-property>
</managed-bean>
</faces-config>
__________________________________________________ _____________________________________
And my web.xml file:
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<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>
</web-app>
__________________________________________________ __________________________________________________ ________________________
Please help me regarding this.