[英]Spring Boot controller does not redirect
I create the following controller:我创建了以下 controller:
@Controller
public class RootController {
@RequestMapping(path = "/login", method = RequestMethod.GET)
public String showLoginPage() {
return "redirect:resources/templates/login.html";
}
}
But, trying to map this endpoint, I receive 404-ERROR.但是,尝试 map 这个端点时,我收到 404-ERROR。 This is a target-page location:
这是一个目标页面位置:
What am I doing wrong?我究竟做错了什么?
@Controller
public class RootController {
@GetMapping("/login")
public String showLoginPage() {
return "login";
}
It works to me.I hope hepls you!它对我有用。我希望对你有帮助!
@Controller
public class RootController {
@GetMapping("/login")
public String showLoginPage() {
return "login.html";
}
This will work这将起作用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.