Jsp Can';t调用servlet post方法

Jsp Can';t调用servlet post方法,jsp,servlets,post,Jsp,Servlets,Post,我想调用doLogOutservlet的post方法,但每次调用servlet时,都会调用Get方法,而不是post方法 这是我的jsp: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> Checkout </title> </head>

我想调用
doLogOut
servlet的
post
方法,但每次调用servlet时,都会调用
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>
但我看到
Get方法:
结果中的消息,为什么?

单击


您可以尝试使用bootstrap的button类
btn链接
,以便将提交按钮用作链接

<form method="post" action="doLogOut">
     <p style="text-align: right;">
          <button type="submit" class="btn-link"> LogOut </button>
     </p>
<form>

注销

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
        <title> Checkout </title>
        <script type="text/javascript">
        function logoutWithAjax() {
            $.ajax({
              type: "POST",
              url: "doLogOut",
              success: function() {
                console.log("Logged out");
              }
            });
        }
        </script>
    </head>
    <body>
        <form id="form" method="post" action="doLogOut">
            <p style="text-align: right;">
                <a href="javascript:{}" onclick="document.getElementById('form').submit();"> LogOut with Form Submit</a>
                <a href="javascript:{}"  onclick="logoutWithAjax();"> LogOut with Ajax Request</a>
            </p>
        </form>
    </body>
</html>
<form method="post" action="doLogOut">
     <p style="text-align: right;">
          <button type="submit" class="btn-link"> LogOut </button>
     </p>
<form>