我捕获了一个 URL:(示例)
在我的 .jsp 中的变量中,然后我必须登录并在后面验证登录正确后,我将页面重定向到我的应用程序的主页,但我想要的是重定向它我在登录之前捕获的 URL。有没有办法在即将重定向时捕获后面的该变量?就像从后面调用前面的函数以便它返回 URL 一样?
这是我重定向的函数:
protected void handle(HttpServletRequest request,
HttpServletResponse response, Authentication authentication) throws IOException {
var urlNew = functionToCaptureURL();
redirectStrategy.sendRedirect(urlNew);
//redirectStrategy.sendRedirect("https://lol.com/home");
}
最佳答案
使用RequestDispatcher::forward而不是 sendRedirect
。检查Difference between JSP forward and redirect了解更多信息。
关于javascript - 有没有办法从后面调用 .jsp 中的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61512517/