首页 > 解决方案 > xhtml 文件不起作用,但 html 文件可以正常工作

问题描述

我是 jsf 的新手,我正在尝试做一些基本的事情。当我运行 .xhtml 文件时,我收到 http 状态 404 错误,但如果我打开文件 ''index.html'' name 。它工作。但是我的 xhtml 文件不起作用。我用 web.xml 尝试了一些东西,但做不到。谁能有任何想法?怎么解决

    <?xml version="1.0"?>
<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">
 <display-name>GaziDortHaftax</display-name>

  <welcome-file-list>
    <welcome-file>demo.xhtml</welcome-file>
  </welcome-file-list>

 <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>*.xhtml</url-pattern>
 </servlet-mapping>
 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.faces</url-pattern>
 </servlet-mapping>
 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>/faces/*</url-pattern>
 </servlet-mapping>
</web-app>

那是我的 web.xml

标签: jsf

解决方案


推荐阅读