s tags @JSF não estão sendo renderizadas como HTML [duplicado]
Esta pergunta já tem uma resposta aqui:
JSF retorna uma página em branco / não analisada com a fonte XHTML / XML / EL simples / bruta em vez da saída HTML renderizada 1 respostaEstou seguindo oJava EE firstcup tutorial usando Netbeans ePeixe de vidr.
Quando executo a camada da Web JSF que fui instruída a codificar, o navegador obtém a mesma marcação JSF codificada no arquivo .xhtml e as tags não são renderizadas como tags HTML. Eu sei disso usando o ver código fonte no meu navegador.
Por exemplo, para este código:
<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>Page title here</title>
</h:head>
<h:body>
<h2>
<h:outputText value="#{bundle.WelcomeMessage}" />
</h2>
</h:body>
</html>
O navegador deve ter algo como:
<html ...>
<head>
<title>Page title here</title>
</head>
<body>
<h2>
the welcome message goes here
</h2>
</body>
</html>
Direita
em, meu navegador está recebendo o código jsf (o primeiro trecho de código acima) e não o código html (o segundo trecho de código acima
Parece ser um problema de configuração no netbeans ou glassfish, mas não sei o quê. Alguma ideia
Este é o meu arquivo web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<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>/firstcup/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>greetings.xhtml</welcome-file>
</welcome-file-list>
</web-app>
Este é o meu arquivo faces-config.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
<application>
<resource-bundle>
<base-name>firstcup.web.WebMessages</base-name>
<var>bundle</var>
</resource-bundle>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>es</supported-locale>
</locale-config>
</application>
<navigation-rule>
<from-view-id>/greetings.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/response.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
Além disso
O URL que estou entrando no navegador éhttp: // localhost: 8081 / firstcup / mas também tentei:http: // localhost: 8081 / firstcup / greetings.xhtml Verifiquei os logs do Glassfish e não há informações sobre não poder carregar o FacesServlet