
5.跳转失败
登录页登录失败后跳转到失败页面
添加失败页面
resources=》static=》error.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
</head>
操作失败,请重新登录
<a href="/login.html">跳转</a>
</html>
在SecurityConfig中添加
//登录失败后跳转页面,POST请求
.failureForwardUrl("/toError");
//error.html不需要被认证,放行
.antMatchers("/error.html").permitAll()
位置截图:
然后去controller层中LoginController.java,添加端口以及跳转
/**
* @return { java.lang.String}
* @throws
* @Author etern
* @Description //TODO 登录失败页面跳转
* @Date 21:29 2022/1/21
* @Param * @param
**/
@RequestMapping("toError")
public String toError() {
//重定向跳转
return "redirect:error.html";
}
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 Eternal Night
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果