从Angular JS页面,当我点击提交时,请求命中我的RestService并在处理完请求后,我正在尝试将response.sendRedirect做到外部应用程序网址。它没有重定向。我尝试在重定向调用之后添加一个return语句。但它没有重定向。浏览器上仍然显示相同的旧页面。
@RequestMapping(value = "getExit", method = RequestMethod.DELETE, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
@ResponseStatus(value = HttpStatus.OK)
public void getExit(HttpServletRequest request, HttpServletResponse response) {
...................
response.sendRedirect("url");
return;
}
答案 0 :(得分:1)
您可以这样重定向
@RequestMapping(value = "getExit", method = RequestMethod.DELETE, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
@ResponseStatus(value = HttpStatus.OK)
public String getExit(HttpServletRequest request, HttpServletResponse response) {
...................
return "redirect:url";
}