【发布时间】:2014-04-05 17:42:04
【问题描述】:
我无法在 (*.html) 中使用 jsf 标签,但如果我将页面更改为 *.xhtml,它就可以工作了。
帮助我理解为什么会这样。
以下是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_2_5.xsd"
version="2.5">
<display-name>Project</display-name>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>FacesServlet</display-name>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>`
【问题讨论】:
-
JSF 正在生成 HTML,它不需要 html 文件作为输入。暗中刺探:你没有告诉你的 Faces Servlet 你想让它渲染
html文件吗?你能告诉我们你的web.xml吗? -
如果我为 *.html 提供映射并且如果我尝试运行 *.html 我会找不到页面