簡體   English   中英

index.html文件出現404錯誤

[英]404 error with index.html file

我運行項目時遇到404錯誤,我的JBoss服務器運行正常。

這是在index.html中:

<html>
<body>

<form action="/services/customers" method="post">
First Name: <input type="text" name="firstname"/><br/>
Last Name: <input type="text" name="lastname"/><br/>
<INPUT type="submit" value="Send">
</form>

</body>
</html>

這是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_3_0.xsd" version="3.0">
<display-name>SIMS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.wcs.rs.Application</param-name>
<param-value>org.jboss.samples.webservices.MyRESTApplication</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<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>/faces/*</url-pattern>
</servlet-mapping>
</web-app>

這是我的文件結構:

在此輸入圖像描述

當我運行這個項目時,我收到404錯誤

http://localhost:8080/SIMS/

我也嘗試過:

http://localhost:8080/SIMS/index.html

這也給出了404如何讓項目運行的想法?

我認為問題是<url-pattern> jsf庫無法找到您的頁面。

嘗試將<url-pattern>更改為<url-pattern>*.jsf</url-pattern>

然后將<welcome-file>重命名為index.jsf並在index.html旁邊創建一個空的index.jsf文件。

嘗試只輸入localhost並從瀏覽樹中選擇您的文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM