Я хочу позвонить doLogOut
метод сервлета post
, но каждый раз, когда я вызываю сервлет, метод Get
был вызван вместо метода post
!Не удается вызвать метод передачи сервлета
Вот мой jsp
:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> Checkout </title>
</head>
<body>
<form method="post" action="doLogOut">
<p style="text-align: right;">
<a href="doLogOut"> LogOut </a>
</p>
</form>
...
</html>
А вот мой doLogOut
сервлета:
@WebServlet(urlPatterns = {"/doLogOut"})
public class doLogOut extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet doLogOut</title>");
out.println("</head>");
out.println("<body>");
out.println("<h3> Get method: </h3>");
out.println("</body>");
out.println("</html>");
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet doLogOut</title>");
out.println("</head>");
out.println("<body>");
out.println("<h3> Post method: </h3>");
out.println("</body>");
out.println("</html>");
}
}
Но я вижу Get method:
сообщений в результате чего?