Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Quick JSP question

  • 26-01-2005 05:21PM
    #1
    Registered Users, Registered Users 2 Posts: 2,323 ✭✭✭


    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, Paid Member Posts: 44,040 Mod ✭✭✭✭Seth Brundle


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


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


    dude that works brilliantly thank you!


Advertisement