mith_cool 0 Junior Poster in Training

There is some problem when i check username and validate it against password from my database.After checking password from request.getParamter() it should say "You have been successfully login"... Perhaps I am getting my own else block message"Incorrect Password..." which means there is some problem with the password thing. Here is my servlet code

        PrintWriter out= response.getWriter();
        String uname= request.getParameter("txtuname");
        String pass= request.getParameter("txtpass");
        Connection con =null;
        try {
            String select="select Password from sign_up where U_Name=\'"+uname+"\'";
            Statement st= con.createStatement();
            ResultSet rs= st.executeQuery(select);
                    out.println("You have been successfully logged in"+uname);
                    out.println("Incorrect Password");
        catch(Exception e)

When i say out.println(rs.getString(1)) it is giving me the correct output.... Any kind of help appreciated!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.