Java intellij tomcat服务器即使在遵循安装说明后仍提供404

Java intellij tomcat服务器即使在遵循安装说明后仍提供404,java,jsp,tomcat,servlets,intellij-idea,Java,Jsp,Tomcat,Servlets,Intellij Idea,我试图在intellij上设置tomcat服务器以使用JSP,但它一直给我404错误。我尝试过谷歌和stack overflow上所有可行的解决方案;然而,这是没有用的 我的tomcat服务器是9.0.0,当我在浏览器上运行localhost:8080时,它会打开默认的tomcat页面 下面是我的web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/j

我试图在intellij上设置tomcat服务器以使用JSP,但它一直给我404错误。我尝试过谷歌和stack overflow上所有可行的解决方案;然而,这是没有用的

我的tomcat服务器是9.0.0,当我在浏览器上运行localhost:8080时,它会打开默认的tomcat页面

下面是我的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_3_1.xsd"
     version="3.1">
<display-name>Hello World Application</display-name>

<servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>com.jc.servlet.Servlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/greeting</url-pattern>
</servlet-mapping>
我为链接tomcat server和intelliJ而执行的设置是在“设置”下的应用程序服务器上添加tomcat 9.0.0,以部署分解的工件并将应用程序上下文设置为/hello world

所以当我去的时候,我应该能够看到我的servlet,但是它给了我一个404错误。但是,当我转到默认页面时,会加载tomcat服务器,使其正常工作


请帮忙。我什么也做不了,因为服务器无法工作。

web.xml:您没有关闭servlet定义末尾的web应用标记。

将应用程序部署到
/webapps/hello world
后,目录
/webapps
的内容是什么?您是通过IntelliJ还是在IDE之外启动Tomcat的?
<%--
Created by IntelliJ IDEA.
User: JC
Date: 28/09/2016
Time: 1:23 AM
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
$END$
</body>
</html>
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by JC on 28/09/2016.
 */
public class Servlet extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    response.getWriter().println("Hello World!");

}
}