title: How to check null values of text fields and put it in if else statements to redirect it to error page?
body: <p>In following code there is a problem in If Else statement. Only Else part of Request dispatcher is executing even if I don't enter anything in Text Fields. Also, how to check null values of text fields inside Java?</p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) 
                                             throws ServletException, IOException {
  
  String Email    = request.getParameter("email");
  String Password = request.getParameter("password");
  
      if (Email == null || Password == null){             
  
          RequestDispatcher rd = request.getRequestDispatcher("JSP Address");
          rd.forward(request, response);
  
      } else {
  
          RequestDispatcher rd = request.getRequestDispatcher("JSP Address");
          rd.forward(request, response);
  
      }
  
  }
  </code></pre>