Tomcat 7在调用静态页面时提供HTTP 405

Tomcat 7在调用静态页面时提供HTTP 405,tomcat,Tomcat,我使用EclipseIDE创建了一个动态项目。我在project CollegeManagement的WebContent文件夹中添加了一个html页面Welcome.html。我在ApacheTomcat-7.0.47上部署了该项目。部署后,我可以在C:\apache-tomcat-7.0.47\webapps中看到一个文件夹CollegeManagement,其中包含Welcome.html。当我右键单击Welcome.html并选择runonserver来运行应用程序时,它给出了错误HTT

我使用EclipseIDE创建了一个动态项目。我在project CollegeManagement的WebContent文件夹中添加了一个html页面Welcome.html。我在ApacheTomcat-7.0.47上部署了该项目。部署后,我可以在C:\apache-tomcat-7.0.47\webapps中看到一个文件夹CollegeManagement,其中包含Welcome.html。当我右键单击Welcome.html并选择runonserver来运行应用程序时,它给出了错误HTTP405。有谁能帮我解决这个问题吗?请在这里找到快照

项目结构图:

HTML页面Welcome.HTML包含

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Welcome</title>
</head>
<body>
<form method="post" action="http://localhost:8181/CollegeManagement/do">
Operation<input type="text" name="op"/>
<button type="submit">Do</button>
</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>CollegeManagement</display-name>
  <welcome-file-list>
   <!--  <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file> -->
     <welcome-file></welcome-file>
  </welcome-file-list>

  <servlet-mapping>
  <servlet-name>welcome</servlet-name>
  <url-pattern>/*</url-pattern>
  </servlet-mapping>
  <servlet>
  <servlet-name>welcome</servlet-name>
  <servlet-class>com.vijay.Welcome</servlet-class>
  </servlet>
</web-app>

学院管理
欢迎
/*
欢迎
欢迎光临
我试图访问服务器上的静态页面,它应该返回而不检查web.xml或HTML文件的内容。为什么不支持返回GET方法

仅供参考:我已经尝试将Welcome.html重命名为College.html,但问题仍然存在


非常感谢

注意:首先检查是否存在任何不正确的url模式

使用以下命令确保默认的servlet容器

  <!-- Disables Servlet Container welcome file handling. Needed for compatibility with Servlet 3.0 and Tomcat 7.0 -->
  <welcome-file-list>
    <welcome-file></welcome-file>
  </welcome-file-list>


这是因为您可能在调用doGet()时没有实际实现doGet()。这是doGet()的默认实现这会引发错误,表示不支持该方法。

您可以共享eclipse web项目结构吗?请发布代码以查找确切的问题…这是项目结构图像欢迎操作。我正在调用静态页面,服务器应返回该页面。在注释完内部的欢迎文件列表后但是,它仍然存在同样的问题。关键是调用静态页面不应该通过web.xml。服务器应在不检查web.xml内的任何设置的情况下返回。如果我错了,请纠正我。