@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:
- [Solved] Cannot call sendRedirect() after the response has been committed
- Solve the problem of “typeerror: ‘bool’ object is not callable” in flash and Django
- Error resolving template [index], template might not exist or might not be accessible by any of the configured Template Resolvers
- This application has no explicit mapping for /error, so you are seeing this as a fallback
- [Solved] No converter found for return value of type: class org.json.JSONObject
- EL1007E: Property or field ‘xxx’ cannot be found on null
- [Solved] java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null”
- The back-end receives the field validation errors passed by the front-end: invalid validation tag on field ‘username’
- How to Solve ra-28000 account being locked Error
- ORA-01940: cannot drop a user that is currently connected [How to Solve]