Khirthan
Khirthan

Reputation: 197

Error in my First JSF Program with Tomcat and Eclipse

Im a Totally new in Java and JSF. I'm using eclipse Indigo and Tomcat 6.0.3 and JSF 2.0. Iam using the Maven and deploying the wars to server.

I configured the server in the Eclipse and i normally get the apache page in Localhost:8080.

But When i try to access my page like localhost:8080/ContactFormJSF/, I get the Message as

HTTP Status 404 - /ContactFormJSF/
type Status report
message /ContactFormJSF/
description The requested resource (/ContactFormJSF/) is not avilable.

This is code like, what there in Adduser.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>JSF 2.0 Hello World</title>
    </h:head>
    <h:body>
        <h3>JSF 2.0 Hello World Example - hello.xhtml</h3>
    </h:body>
</html>

I Have even configured the "servlet-mapping","welcome-file-list" in the Web.xml

My web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee">
    <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>*.xhtml</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>AddUser.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

<session-config>
      <session-timeout>15</session-timeout> 
    </session-config>
</web-app>

Upvotes: 0

Views: 627

Answers (1)

kark
kark

Reputation: 4853

Check the following Conditions

  1. Check the required jars inserted under WEB-INF/lib directory(Strongly recommended)
  2. Check the servlet has been mapped in Web.xml
  3. Check your invoking correct URL pattern in browser

Upvotes: 1

Related Questions