SpringFramework中重定向
需求:
- 需要在两个@Controller之间跳转,实现重定向
解决:
@PostMapping("/files/{path1}")
public String upload(...) {
// ...
return "redirect:files/{path2}";
}
多看看官方文档还是有很多好处
Spring文档链接地址:
- https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#mvc-redirecting-redirect-prefix