我正在尝试使用Eclipse IDE在Apache Tomcat上执行一个简单的servlet。 servlet本身正在执行,但是当我尝试调用html表单时,我将把用户数据传递给servlet,我得到错误404。 我的方法不正确吗?
更新1: 文件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" 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" id="WebApp_ID" version="3.0">
<display-name>assign3_servlets</display-name>
<welcome-file-list>
<welcome-file>clientFile.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>DbServlet</servlet-name>
<servlet-class>com.appperfect.training.DbServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DbServlet</servlet-name>
<url-pattern>/DbServlet</url-pattern>
</servlet-mapping>
</web-app>
文件clientFile.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JDBC - Servlets</title>
</head>
<body bgcolor="white">
<form action="DbServlet" method="post" >
<table>
<tr>
<td>JDBC Driver</td>
<td> <input type="text" id="jdbc_driver" size="30"> </td>
</tr>
<tr>
<td>JDBC URL</td>
<td><input type="text" id="jdbc_url" size="30"></td>
</tr>
<tr>
<td>User Name</td>
<td><input type="text" id="uname" size="30"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" id="pass" size="30"></td>
</tr>
<tr>
<td>Query</td>
<td><input type="text" id="query" size="30"></td>
</tr>
<tr>
<td></td>
<td ><input type="submit" id="submit_query"></td>
</tr>
</table>
</form>
</body>
</html>