@Controller
public class MainControll {
@Autowired
UserRepository userRepository;
@RequestMapping("/")
public String index() {
return "index";
}
@RequestMapping(value = "/index/judement", method = RequestMethod.POST)
@ResponseBody
public Map<String,String> hasuser(@RequestBody UserinfoEntity a) {
if (userRepository.findAccount(a.getNumber())==null || !a.getPassword().equals(userRepository.findAccount(a.getNumber()))) {
Map<String,String> map = new HashMap<>();
map.put("message","passwordError");
return map;
}
Map<String,String> map_1 = new HashMap<>();
map_1.put("message","true");
return map_1;
}
}
this is my code, When the user clicks the login button, it will enter the method hasuser
, and then I will check the database and compare the password, if true, I want to generate the session and send back the cookie, how can i do?
I try one method, but why it can not import ?