我想在打开页面和POST参数时重定向用户。我尝试过:
@PostMapping(value = "/redirect/{token}"})
public ModelAndView handleRedirectMessage(@PathVariable("token") String token,
@RequestBody Transaction transaction, HttpServletRequest request) throws Exception {
String post_param = "some_payload";
return new ModelAndView("redirect:" + url);
}
是否可以重定向用户并发布一些参数?
答案 0 :(得分:0)
例如,您有
@GetMapping("/sample_request_mapping_path")
public ModelAndView something() {
//...
}
修改为
@PostMapping(value = "/foo"})
public ModelAndView handleRedirectMessage(@PathVariable("token") String token, @RequestBody Transaction transaction, HttpServletRequest request) throws Exception {
String post_param = "some_payload";
return "redirect:/sample_request_mapping_path";
}