In order to do so, I have the following snippet from my servlet, DataEntry.java
Expand|Select|Wrap|Line Numbers
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
- {
- try
- {
- boolean success_register = authenticate_register(request.getParameter("first_name"),
- request.getParameter("last_name"),request.getParameter("realDob"));
- /*
- autheticate_register( ) is a straight forward implementation of opening
- a connection, retrieving from database values where name="first_name"
- and so, and checking if the retrieved values are null.
- If they are null, I return "true", meaning they don't exist in the DB already.
- Else, I return "false"
- */
- if(success_register)
- {
- response.sendRedirect("SuccessLogin.jsp");
- /* Followed by code to actually write the first name,
- last name and DoB into the DB.*/
- }
- else
- {
- response.sendRedirect("Welcome.jsp");
- }
- }//End-try
- catch(Exception e) { }
- }//End doPost()
The redirection is happening only to success.jsp in either case, whether success_register is "true" or "false".
But, the DB values are not entered if authenticate_register( ) evaluates to "false", which is what is supposed to happen.
A System.out.print( ) on the values of success_register shows "true" even if the value showed by the expression being returned within authenticate_register( ) is "false".
I am stumped. What's going on??