I'm assuming that you are actually entering that while() loop (i.e. data is coming back from the query).  In that case, it seems likely that a SQLException is being thrown by either myResultSet.getString("UserLoginId") or myResultSet.getString("UserPassword").   The most likely cause of this is that you've got the wrong name for a column (i.e. UserLoginId or UserPassword does not exist in the results of the query you execute to get myResultSet).  Check your column names.  Also, I assume you're going to be catching SQLException's somewhere nearby: output the error message, it's generally quite informative.
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Praveen Potineni
Sent: Wednesday, November 14, 2001 7:59 AM
To: [EMAIL PROTECTED]
Subject: Login Authentication against database...

Hi all,
I'm doing a Username/password validation against Sybase database.
When the user enters the details i check for the values in the database and if it dosen't match i redirect to login page.
I got the result set from the query and i check if the username/password entered exists in the database...
login.jsp:::
 
id = request.getParameter("username");  
   pin = request.getParameter("password");
if (loginBean.UserExists(id,pin) == true) {
     session.setAttribute("user", id);
     monitor.put(id, session);
     System.out.println("************Assigned new session for: " + id);
     session.setMaxInactiveInterval(900);
     display = "control.jsp?";
  }
  else{
     display = "showLogin.html"; 
  }
%>
<jsp:forward page="<%= display %>"/>
 
Login.java:::
 
while(myResultSet.next()){
    String uid = myResultSet.getString("UserLoginId");
    String upin = myResultSet.getString("UserPassword");
   
     if ((username.equals(uid)) && (password.equals(upin))){
      validUser = true;
    }
   }
 
When i debug i find that ""if ((username.equals(uid)) && (password.equals(upin)))"" dosen't execute...That means i'm doing a mistake in that code...
Can someone help me with this....
 
Thanks
Praveen

Reply via email to