From df7794c382ddc27435af58d0aa2b239206869847 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Tue, 25 Sep 2018 01:30:05 +0530 Subject: [PATCH] [BAEL-9021] - Fixed compilation error and uncommented module in parent pom.xml --- pom.xml | 4 ++-- .../baeldung/spring/mybatis/controller/StudentController.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 4ffd9ba4a4..e978664c46 100644 --- a/pom.xml +++ b/pom.xml @@ -642,7 +642,7 @@ spring-mobile spring-mvc-simple - + spring-mybatis spring-rest-hal-browser spring-rest-shell spring-rest-template @@ -959,7 +959,7 @@ spring-mobile spring-mvc-simple - + spring-mybatis spring-rest-hal-browser spring-rest-shell spring-rest-template diff --git a/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java b/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java index 427613f23f..c1e5579103 100644 --- a/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java +++ b/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java @@ -31,7 +31,7 @@ public class StudentController { @RequestMapping(value = "/signup", method = RequestMethod.POST) public String signup(@Validated @ModelAttribute("student") Student student, BindingResult result, ModelMap model) { - if (studentService.getStudentByUserName(student.getUserName())) { + if (studentService.getStudentByUserName(student.getUserName()) != null) { model.addAttribute("message", "User Name exists. Try another user name"); return "signup"; } else { @@ -50,7 +50,7 @@ public class StudentController { @RequestMapping(value = "/login", method = RequestMethod.POST) public String login(@ModelAttribute("studentLogin") StudentLogin studentLogin, BindingResult result, ModelMap model) { - boolean found = studentService.getStudentByLogin(studentLogin.getUserName(), studentLogin.getPassword()); + boolean found = studentService.getStudentByLogin(studentLogin.getUserName(), studentLogin.getPassword()) != null; if (found) { return "success"; } else {