此URL不支持HTTP方法GET

0 java servlets

我正在使用jsp页面的超链接访问注销servlet时遇到代码问题.

Jsp页面链接:

HREF = "/注销"

注销Servlet:

public class logOut extends HttpServlet{

public void doGET(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {

    resp.setContentType("text/html"); 
    System.out.println("log out servlet");
    HttpSession session = req.getSession(false);
    if (session != null) {
        session.invalidate();
    }
    resp.sendRedirect("/signin.jsp");
}
}
Run Code Online (Sandbox Code Playgroud)

但我有以下错误:

HTTP ERROR 405

Problem accessing /logout. Reason:

HTTP method GET is not supported by this URL
Run Code Online (Sandbox Code Playgroud)

请帮我.....

Thi*_*ilo 10

它被称为doGet,而不是doGET.

@Override注释会告诉你的.