Can sendRedirect() act as a post method instead of get? - jsp/servlets

前端 未结 6 1861
暖寄归人
暖寄归人 2020-12-29 07:18

I have a simple form which accepts a username and a password. I have to use sendRedirect() method for the page to redirect to one page if log in is valid and to

6条回答
  •  萌比男神i
    2020-12-29 08:21

    This is kinda old, but here I've succesfully run this:

    response.setStatus(307); //this makes the redirection keep your requesting method as is.
    response.addHeader("Location", "http://address.to/redirect");
    

    See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.8 for explanation of HTTP 307 status code.

提交回复
热议问题