gpt4 book ai didi

html - JSF2.2 标签使用 *.xhtml 但不使用 *.html

转载 作者:行者123 更新时间:2023-11-28 01:46:57 24 4
gpt4 key购买 nike

我无法在 (*.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>`

最佳答案

将其包含在您的 web.xml 中

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.html</param-value>
</context-param>

关于html - JSF2.2 标签使用 *.xhtml 但不使用 *.html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22167709/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com