解决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";
        }
    }
上一篇:使用Jedis连接Redis


下一篇:Ajax请求415