Payara一直为index.xhtml提供404错误

问题描述 投票:1回答:1

所以我正在使用payara开发Java ee应用程序。我想尝试JSF来设置一些网页。但无论我尝试什么,我都无法让我的应用程序找到index.xhtml页面。看起来我正确配置了一切。我的猜测是我的神器在部署时不会占用我的jsf文件,但我不知道如何检查这个。

我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
     version="4.0">
<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>
<welcome-file-list>
    <welcome-file>/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>

我的glassfish-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
</glassfish-web-app>

这些文件位于目录中,如project / source / main / webapp / WEB-INF /

我的index.xhtml位于webapp目录中。

有谁知道我做错了什么?

jsf http-status-code-404 payara
1个回答
2
投票

这发生在我身上。我从欢迎文件中的路径中删除了前导“/”,之后它对我有用。

<welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
© www.soinside.com 2019 - 2024. All rights reserved.