1

I get a 404 error when I run my project, my JBoss server is running fine.

Here is in the 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>

And here is the web.xml file:

<?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>

And here is my file structure:

enter image description here

When I run this project I get a 404 error

http://localhost:8080/SIMS/

I also tried:

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

This also gave a 404 any ideas on how to get the project to run?

4

2 回答 2

2

我认为问题出在<url-pattern>. jsf 库找不到您的页面。

尝试将您的更改<url-pattern><url-pattern>*.jsf</url-pattern>

然后将其重命名<welcome-file>为 index.jsf 并在 index.html 旁边创建一个空的 index.jsf 文件。

于 2014-01-23T21:19:55.173 回答
1

尝试输入 localhost 并从浏览树中选择您的文件

于 2014-01-23T20:37:14.617 回答