Código xhtml não funciona

5 respostas
U

Boa tarde amigos,

Estou com um grande problema em executar meu código xhtml no meu servidor tomcat 7.0 com jsf 2.1 segue minhas configurações e meu código xhtml. Já venho tentando concertar a dias e não encontro nada que eu consiga resolver esse problema.

Configuração do web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>FinanceiroWeb</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>FacesServlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
</web-app>
Código xhtml
<?xml version="1.0" encoding="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:h="http://www.java.sun.com/jsf/html"
	xmlns:f="http://www.java.sun.com/jsf/core">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Teste Inicial JSF</title>
</h:head>
<h:body>
	<h:outputText value="Olá Mundo"/>
</h:body>
</html>

Ao executar no tomcat 7 pelo eclipse
[img]http://www4.worldrag.com/imagem/di-7KAV.png[/img]
Tudo em braco :cry:

5 Respostas

fbl.lucas

o olamundo.xhtml ta dentro de /WenContent/olamundo.xhtml?

U

Está sim!

fbl.lucas

Está sim!

Não sei então, da uma olhada aqui: http://www.mkyong.com/jsf2/jsf-2-0-hello-world-example/

U

Está sim!

Não sei então, da uma olhada aqui: http://www.mkyong.com/jsf2/jsf-2-0-hello-world-example/

Ok, obrigado pela atenção, vou fazer alguns testes. Qualquer coisa posto aqui. =)

asandrob

Você definiu *.jsf como padrão e quer ler uma página com extensão XHTML.
Troque para *.xhtml que funciona.

<url-pattern>*.xhtml</url-pattern>
Criado 15 de agosto de 2012
Ultima resposta 15 de ago. de 2012
Respostas 5
Participantes 3