title: How can I alert message in Servlet code and sendredirect to JSP page?
body: <p>I am trying to make a simple login page to deal with database using JSP, servlet with MVC concept and Data Access Object(DAO) and I am new in this. My problem now that I need to alert a box message in servlet if the user enters invalid name and password and sendRedirect to login.jsp page again. I set flag to be 1 if the user valid then do this if-check </p>
  
  <pre><code>if(validUserFlage == 1)
      response.sendRedirect("User_Manipulation_Interface.jsp");
  else {   
      //Here i want to alert message cause user invalid ??
      response.sendRedirect("Admin_And_User_Login_Form.jsp");
  }
  </code></pre>
  
  <p>searching for this i find this answer but i can`t understand how can i do it
  the answer i found:
  (( With send redirect you cant display the message where you want in the code. So as per me there might be two approaches. Display a message here and use include of requestdispatcher instead of send redirect or else pass some message to admin.jsp and display the message there. ))</p>