HTTP 404 Java 小服务程序
HTTP 404 Java Servlets
点击提交时出现此错误
HTTP Status 404 - /GradeRetrieval/DbConnection
type Status report
message /GradeRetrieval/DbConnection
description The requested resource is not available.
这是表单标签,我的 HTML 表单有一个提交按钮。
<form action="../DbConnection" method="post">
这是我的目录结构
这是我的 webxml 文件
<?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>GradeRetreival</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-list>
<servlet>
<description></description>
<display-name>DbConnection</display-name>
<servlet-name>DbConnection</servlet-name>
<servlet-class>DbConnection</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DbConnection</servlet-name>
<url-pattern>DbConnection</url-pattern>
</servlet-mapping>
</web-app>
我似乎无法弄清楚哪里出了问题。请帮忙。
IIRC,需要完整指定servlet名称:
<servlet-class>action.DbConnection</servlet-class>
另外,确保你的 url-pattern
是正确的。
点击提交时出现此错误
HTTP Status 404 - /GradeRetrieval/DbConnection
type Status report
message /GradeRetrieval/DbConnection
description The requested resource is not available.
这是表单标签,我的 HTML 表单有一个提交按钮。
<form action="../DbConnection" method="post">
这是我的目录结构
这是我的 webxml 文件
<?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>GradeRetreival</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-list>
<servlet>
<description></description>
<display-name>DbConnection</display-name>
<servlet-name>DbConnection</servlet-name>
<servlet-class>DbConnection</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DbConnection</servlet-name>
<url-pattern>DbConnection</url-pattern>
</servlet-mapping>
</web-app>
我似乎无法弄清楚哪里出了问题。请帮忙。
IIRC,需要完整指定servlet名称:
<servlet-class>action.DbConnection</servlet-class>
另外,确保你的 url-pattern
是正确的。