@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";
}
}