1
votes

i have a dynamic web application in eclipse using jsf . i created a jsp page with 'new java server faces(jsf) page(xhtml)' template and want to show just a h:inputText but when i run my app in tomcat the inputText doesn't show up .

when i use 'new java server faces(jsf) page(html)' template i wont have any problem but i have to use xhtml in my project .

i'm using eclipse indigo sr2 3.7.2 - myfaces 2.0.14 - tomcat 7.0.29

my jars : commons-beanutils-1.8.3 - commons-codec-1.3 - commons-collections-3.2 - commons-digester-1.8 - commons-logging-1.1.1 - jstl-api-1.2 - jstl-impl-1.2 - myfaces-api-2.0.14 - myfaces-bundle-2.0.14 - myfaces-impl-2.0.14

main.jsp :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
   pageEncoding="ISO-8859-1"%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</h:head>
<h:body>
<f:view>
 <h1>JSF XHTML</h1>
<h:inputText value="Hi"></h:inputText>
</f:view>
</h:body>
</html>

what's the problem ?

1

1 Answers

2
votes

i changed main.jsp to main.xhtml and added these lines to my web.xml and now my project working fine .

  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>

thanx for your attention