estoy siguiendo el Java EE firstcup tutorial usando Netbeans y Glassfish.etiquetas JSF no ser prestados como HTML
Cuando ejecuto el nivel web JSF, me han indicado que codifique, el navegador obtiene el mismo marcado JSF codificado en el archivo .xhtml, y las etiquetas no se representan como etiquetas HTML. Lo sé usando el código fuente para ver la fuente en mi navegador.
Por ejemplo, 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>
El navegador debe obtener algo como:
<html ...>
<head>
<title>Page title here</title>
</head>
<body>
<h2>
the welcome message goes here
</h2>
</body>
</html>
derecho?
Bueno, mi navegador está recibiendo el código jsf (la primera parte del código anterior) y no el código html (la segunda parte del código anterior).
Parece ser un problema de configuración en netbeans o glassfish, pero no sé qué. ¿Algunas ideas?
Este es mi archivo 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 es mi archivo 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>
Además:
- La url I ' m entrar en el navegador es http://localhost:8081/firstcup/ pero también he intentado: http://localhost:8081/firstcup/greetings.xhtml
- He revisado los registros de Glassfish y no hay información acerca de no ser capaz de cargar FacesServlet
Impar También dijo que había intentado 'http: // localhost: 8081/firstcup/greetings.xhtml'. Eso debería haber funcionado tan bien sin un archivo de bienvenida. Al menos, la causa raíz del problema sigue siendo que la solicitud fue ** no ** pasada a través del 'FacesServlet'. – BalusC