[Solved] Error resolving template “XXX”, template might not exist or might not be accessible by any of the

 @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","Incorrect username or password");
            return "/index";
        }
    }

Remove /

 @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","Incorrect username or password");
            return "index";
        }
    }

Similar Posts: