title: spring mvc controller class is not working
body: <p>In my project I have a page which contains email and password field.
  my requirement is,after filling username and password fields,when I press submit,It will check username and password fields in database table..and if it match then it will go to the profile page.</p>
  
  <p>so,I have done this:</p>
  
  <p>mycontroller class is:</p>
  
  <pre><code>@RequestMapping(value = "/signin", method = RequestMethod.POST)
      public String dologin(@ModelAttribute("student") Student student,HttpServletRequest request,
              HttpServletResponse response,BindingResult result) {
  
  
            try{
             studentService.LoginStudent(student.getEmail(), student.getPassword());
  
                   if (result.hasErrors()) {
                    return "signin";
                  }
                }
                catch(ConstraintViolationException e){
  
              }
  
          return "profile";
      }
  </code></pre>
  
  <p>my StudentServiceimpl.java is:</p>
  
  <pre><code>public Student LoginStudent(String email, String password) {
  
          Student student = new Student(email,password);
  
  
          studentDao.LoginStudent(student);
  
          return student;
      }
  </code></pre>
  
  <p>and StudentDao.java is:</p>
  
  <pre><code>public void LoginStudent(Student student) {
         String hql = "select student_id from  student  where email = :email and password = :password";
  
          sessionFactory.getCurrentSession().createSQLQuery(hql)
          .setParameter("email", student.getEmail())
          .setParameter("password", student.getPassword());
  
      }
  </code></pre>
  
  <p>now,the problem is If I put any email id and any password it is directly going to the profile page.if the fields are blank then it is also going to the profile page.why it is not checking the fields?</p>