HTTP 状态 404 - /sampleServlet/

HTTP Status 404 - /sampleServlet/

在为 servlet 创建文件时出现错误。

错误代码:

HTTP 状态 404 - /sampleServlet/ 类型状态报告 消息/sampleServlet/ 描述 请求的资源不可用。阿帕奇 Tomcat/8.0.0-RC5

Java 代码:sampleServlet.java

package test;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class sampleServlet extends HttpServlet{

    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException{
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<body>");
        out.println("<h1>Hello Servlet Get</h1>");
        out.println("</body>");
        out.println("</html>"); 
    }
}

JSP 页面:index.jsp

<html>
  <body>
     <form action="sampleServlet" method="GET">
      <input type="submit" value="Submit form "/>
     </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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>faltu3</display-name>
    <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>sampleServlet</servlet-name>
      <servlet-class>test.sampleServlet</servlet-class>
    </servlet>
    <servlet-mapping>
      <servlet-name>sampleServlet</servlet-name>
      <url-pattern>/sampleServlet</url-pattern>
    </servlet-mapping>
</web-app>

请帮我解决这个错误。 谢谢

仅限操作 sampleServlet/sampleServlet/

<form action="sampleServlet" method="GET">