with response.sendRedirect("URL");, I found that I know that I lost the ...">

JSP Redirection: Session Loss Issues

Replacing <jsp:forward page="URL">with response.sendRedirect("URL");, I found that I know that I lost the session after the redirect. Is there a way to save a session with a redirect, or recreate a session cookie and send it along with a redirect?

I know that I could use JavaScript through window.location = "URL";, but this is far from ideal!

Any help?

+3
source share
2 answers

You do not need to resend the cookie, because if you have a session, the cookie should already be on the client (browser).

, ? ? , URL-, ?

? URL. . HttpServletResponse.encodeRedirectURL, URL- response.sendRedirect.

+2

jsp: forward, URL, . .

sendRedirect() , URL- -. , URL-, .

, ; , , , .

, : 1) URL- , cookie . 2) URL- cookie, cookie . 3) . URL-, jsp: forward, , .

, cookie URL-.

+2

Source: https://habr.com/ru/post/1708256/


All Articles