404错误,使用index.html右键单击然后运行时找不到服务器

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

我在IntelliJ中遇到了Tomcat服务器的问题。在程序右上角的配置中选择Tomcat时,我的程序将运行。出于某种原因,我的教授希望我们能够右键单击index.html页面并选择运行。当我这样做时,我收到404错误:

描述源服务器未找到目标资源的当前表示,或者不愿意透露存在该目标资源。

我不确定我的设置有什么问题。我将我的程序转移到我的朋友配置,它有同样的问题。我还将她的机器上没有这个问题的项目转移到了我的项目中。在我的设置上运行时,她的程序有同样的问题。

的index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/userEmailList.css">
</head>
<body>
<h1>Join our email list</h1>
<p>Please click any button below to perform the desired action </p>

<a href ="delete.jsp"><input type="button" value = "DELETE"></a>
<a href ="insert.jsp"><input type="button" value = "INSERT"></a>
<a href ="update.jsp"><input type="button" value = "UPDATE"></a>

<form action="emailList" method="post">

    <h1>Click the button below to view all records </h1>
    <input type="hidden" name="action" value="select_records">
    <input type="submit" name="action" value="SELECT RECORDS">

</form>
</body>
</html>

的servlet

<?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>EmailListServlet</servlet-name>
        <servlet-class>EmailListServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>EmailListServlet</servlet-name>
        <url-pattern>/emailList</url-pattern>
    </servlet-mapping>

</web-app>

我应该能够以这种方式运行程序。但是右键单击index.html - > Run不起作用

java jsp servlets intellij-idea tomcat9
1个回答
0
投票

请尝试将URL更改为“http://localhost:8080/ / index.html”。 YouTrack的相关问题:https://youtrack.jetbrains.com/issue/IDEA-206534

© www.soinside.com 2019 - 2024. All rights reserved.