JSP Login PAge

Hello every1,

Im trying to create a login page, but all im getting is login Unsuccessful, can you please have a look at the code bellow and Help me please.

Thank you.

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>

<%

Connection con = null;

Statement stat = null;

ResultSet rs = null;

String CusID = request.getParameter("customerid"); // htm form param > store in - email

String Pass = request.getParameter("password");

String rURL = "...";

if (Pass.length() == 0){response.sendRedirect(rURL); }

try

{

Class.forName("org.gjt.mm.mysql.Driver");

con = DriverManager.getConnection("...");

stat = con.createStatement();

rs = stat.executeQuery("select * from customers WHERE customerid='"+CusID+"'");

boolean found = false;

String customerid = "";

String password = "";

while (rs.next())

{

customerid = rs.getString("customerid");

password = rs.getString("password");

if (customerid.equals(CusID) && password.equals(Pass)) {

found = true;

}

} // end while

if (found == true){

out.println("<h2>Login Successful</h2>");

out.println("Welcome back <b>" + customerid + "</b>!

");

}// ~if

if (found == false) {

out.println("<h2>Login Unsuccessful</h2>");

}// ~if

rs.close();

}// end try

catch (Exception e) {

%>

<%=e.getMessage()%>

<%}

%>

[1642 byte] By [A-Uka] at [2007-10-2 16:53:44]
# 1
Are you getting the parameters correctly?Try this debugging statement on your page:You entered customerID '<%= CusID %>' and password '<%= Pass %>'
evnafetsa at 2007-7-13 18:05:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thank you very much for the help, Im getting the following, Im sorry but im very new to this and I really appereatiate your help. You entered customerID 'null' and password 'password'Any IdeaThanks again
A-Uka at 2007-7-13 18:05:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Thank you very much,, I solved it, what you told me tocheck did really help,,,Thanks again.
A-Uka at 2007-7-13 18:05:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Good to hear you got it sorted.
evnafetsa at 2007-7-13 18:05:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Thank you,,,
A-Uka at 2007-7-13 18:05:55 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...