登录页登录失败后跳转到失败页面
添加失败页面
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";
    }