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

Another question for you

Options
  • 12-11-2005 10:48am
    #1
    Registered Users Posts: 868 ✭✭✭


    Can't see what's wrong with this

    It's part of a simple login code in a JAva servlet

    - Database has table with Username and Password fields

    - The servlet takes the users input from a HTML form and check it against the database
    - The string from the HTML form is called 'Username' and the string retrieved from the database is called 'usercheck'
    - Same with the password; 'password' & 'passcheck'

    I'm using this code to check validity

    if((Usercheck == userName) && (Passcheck == password))
    {
    out.println("successfull");
    }

    but it's just returning a blank page..

    I know this is simple stuff for most of you, but I'd appreciate some help...it's wreacking me head!

    Thanks,

    D.


Comments

  • Closed Accounts Posts: 324 ✭✭madramor


    1:
    user enters username and password in html from and hits submit

    2:
    servlet gets username and password
    You should do a check to see if username and password are
    if(UserCheck == null)
       out.println("enter username");
    if(PassCheck == null)
       out.println("enter password");
    

    3:
    get data from DB,
    you only get the password not the username
    "select password from table where username = ?;"
    if(result.next()){
       if(passCheck.equals(result.getString("password")))
    	out.println("successful");
       else
            out.println("password incorrect");
    }
    else
       out.println("username not in database");
    

    4:
    but it's just returning a blank page.
    you should paste the whole servlet to see if you
    have other problems.

    5:
    did you get a hello world problem working


Advertisement