FacesServlet не интерпретирует мой код xhtml
У меня есть настройки JSF, перечисленные ниже. Если я позвоню
http://localhost:8080/newSheet.jsf
Я получаю исходное содержимое страницы xhtml вместо визуализированного вывода html.
Я знаю, что об этом много раз спрашивали на SO. Ответ кажется, что web.xml
неправильная настройка, в результате чего FacesServlet не вызывается.
Однако мой случай другой. У меня есть точка останова на FacesServlet.service()
который бьет каждый раз. Я также проверил, что он вызывается с нужным URL.
web.xml
<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_2_5.xsd"
id="WebApp_ID" version="2.5">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--
FacesServlet is main servlet responsible to handle all request.
It acts as central controller.
This servlet initializes the JSF components before the JSP is displayed.
-->
<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>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
newSheet.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:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
</h:head>
<h:body>
<h:form>
<h1>
<h:outputText>Add a new sheet</h:outputText>
</h1>
<p>
<h:outputText>Description</h:outputText>
<h:inputText value="{#addSheet.description}" />
</p>
<p>
<h:outputText>Widht</h:outputText>
<h:inputText value="{#addSheet.width}" />
</p>
<p>
<h:outputText>Height</h:outputText>
<h:inputText value="#{addSheet.height}" />
</p>
<h:commandButton value="Submit" action="#{addSheet}"/>
</h:form>
</h:body>
</html>