Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Quick JSP question

Options
  • 26-01-2005 5:21pm
    #1
    Registered Users Posts: 2,320 ✭✭✭


    I have a webpage that has a login and a password. The user enters their username and password into a form which opens up a new jsp page that checks the login details. My question is how do i open up a page based on whether they have ented in the correct details? I have the following code :
    // Iterate over the ResultSet
    String user, pass;
    boolean found = false;
    user = request.getParameter("username");
    pass = request.getParameter("password");
    
    while  (rs.next()) {
             out.println("<TR>\n<TD> checking\n </TD>");
             if (rs.getString("loginName").equals(user)){
    	out.println("<TR>\n<TD> found user\n </TD>");
    	
                 if (rs.getString("loginPassword").equals(pass)) {
    	   out.println("<TR>\n<TD> found password\n </TD>");
    	}//end if
    
             }//end if
    
    } //end while
    
    

    I've tested this code and while its not pretty it works. But i want it to open a menu page if the details are valid or return to the login page if the details are invalid. I have the seperate page for checking because i dont really know how to incorporate the checking in the login page.

    Any ideas?

    All the best,

    Darren


Comments

  • Moderators, Politics Moderators Posts: 39,765 Mod ✭✭✭✭Seth Brundle


    <jsp:forward page="menu_page.jsp"/>


  • Registered Users Posts: 2,320 ✭✭✭Q_Ball


    dude that works brilliantly thank you!


Advertisement