[英]Redirect still remains in the same page in Spring MVC
I want to redirect to my home page, but this doesn't work: 我想重定向到我的主页,但这不起作用:
@RequestMapping(value = "logout", method = RequestMethod.GET)
public String logout(HttpSession session) {
this.setSessionAccount(session, null);
return this.getRedirect("/index");
}
My current page is host/u/center
. 我当前的页面是
host/u/center
。 There's some response record: 有一些回应记录:
You should 你应该
return "redirect:/index"
instead of calling another method of the controller. 而不是调用控制器的另一个方法。
I know what's the problem. 我知道这是什么问题。 I use an ajax get request.
我使用ajax get请求。 So I still remains in the same page.
所以我仍然在同一页面。 Anyway,tanks for your answers.
无论如何,坦克为您的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.