其他分享
首页 > 其他分享> > 解决Error resolving template "XXX", template might not exist or might not be accessible by a

解决Error resolving template "XXX", template might not exist or might not be accessible by a

作者:互联网

 @RequestMapping("/user/login")
    public String login(@RequestParam("username")String username, @RequestParam("password") String password, Model model, HttpSession session){
        if(username!=null&&password.equals ("123456"))
        {
            session.setAttribute ("loginUser",username);
            return "redirect:/main.html";
        }
        else{
            model.addAttribute ("msg","用户名或密码错误");
            return "/index";
        }
    }

去掉/

 @RequestMapping("/user/login")
    public String login(@RequestParam("username")String username, @RequestParam("password") String password, Model model, HttpSession session){
        if(username!=null&&password.equals ("123456"))
        {
            session.setAttribute ("loginUser",username);
            return "redirect:main.html";
        }
        else{
            model.addAttribute ("msg","用户名或密码错误");
            return "index";
        }
    }

标签:accessible,username,return,String,RequestParam,session,template,password,might
来源: https://www.cnblogs.com/Liuyunsan/p/15669122.html