The Exception is probably thrown by the code:
String tempuser=rs.getString("loginname")
since rs is probably null. You may use the following code:

rs=stmt1.executeQuery("select loginname,password from lecturer where
loginname='"+name+"'");
if(!rs.next()){
String temppass;
String tempuser=rs.getString("loginname");
}

else{
out.println(" Still You are not a Registered member ");
out.println("You may want to <A HREF=\"http://localhost:7070/rw\">Reigister
>first</A>");
}

other code

>From: Lalith Jayaweera <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>        Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: jdbc/Resultset problem exists
>Date: Sun, 17 Oct 1999 13:09:32 +0500
>
>Hi,
>
>This is the problem I have.
>
>...
>String name = req.getParameter("LoginNmae");
>tring passwd = req.getParameter("passwd");
>...
>..
>rs=stmt1.executeQuery("select loginname,password from lecturer where
>loginname='"+name+"'");
>rs.next();
>String temppass;
>String tempuser=rs.getString("loginname");
>
>if(rs.wasNull()){
>
>out.println(" Still You are not a Registered member ");
>
>out.println("You may want to <A HREF=\"http://localhost:7070/rw\">Reigister
>first</A>");
>...
>
>else  //else routine
>    ...
>   ....
>
>The code is basically a part of authentication code.It gets the username
>and
>password from the user and check whether he/she is a valid member.
>
>Before enter into the system they(users) have to be registered.
>
>The above code works for the following two situations
>1)user enters correct password and correct username
>2)user enters invalid password and corrext username(it rejects the user
>properly)
>
>
>The above two works since it comes under else routine.
>
>But the problem is if he enters the invalid username(which is not in the
>database) it gives an Exception "Invalid Cursor state".
>
>In the above code I did not use an While(rs.next())  since there can be one
>user name for a given user.(the rs should contain one entry)
>How can I check the above that is when there are no loginname which match
>to
>his loginname.
>
>
>thanks
>
>lalith
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to