我在JoinCustomerToAccountServlet
-
src/controller
个servlet
@WebServlet("/JoinCustomerToAccountServlet")
public class JoinCustomerToAccountServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
}
}
在joinCustomerToAccount.jsp
-
WebContent/ActionsPages
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title></title>
</head>
<body>
<form action="JoinCustomerToAccountServlet" method="POST">
Account join to him : <input type="text" name="account" />
<input type="submit" value="join" />
</body>
</html>
填写完表格后按下提交按钮我
type Status report
message /MyBankProject/ActionsPages/JoinCustomerToAccountServlet
description The requested resource (/MyBankProject/ActionsPages/JoinCustomerToAccountServlet) is not available.
它看起来像在他的文件夹下搜索表单而不是搜索servlet。
答案 0 :(得分:2)
由于您的网址映射为/JoinCustomerToAccountServlet
,并且您的JSP位于/MyBankProject/ActionsPages
内,因此您必须将表单的操作更改为:
<form action="../JoinCustomerToAccountServlet"
让它发挥作用。