sách gpt4 ai đã đi

java - 此 URL 不支持 HTTP 方法 GET

In lại 作者:行者123 更新时间:2023-12-01 06:41:17 28 4
mua khóa gpt4 Nike

当我从 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");
}
}

但我遇到以下错误:

HTTP ERROR 405

Problem accessing /logout. Reason:

HTTP method GET is not supported by this URL

请帮帮我......

1 Câu trả lời

它被称为doGet, thay vìdoGET.

@Ghi đè 注释会告诉你这一点。

关于java - 此 URL 不支持 HTTP 方法 GET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7024117/

28 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com