*
The moose likes Servlets and the fly likes Always responding invalidLogin.jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Always responding invalidLogin.jsp" Watch "Always responding invalidLogin.jsp" New topic
Author

Always responding invalidLogin.jsp

Kasparov Patel
Ranch Hand

Joined: Jan 23, 2012
Posts: 40
Hello All,

I am trying to create login page. But it is always responding with invalid.jsp whether there is user in database or not. Please check my as follow:

1). LoginPage.jsp


2). LoginServlet



3). UserBean


4). UserDAO



5). ConnectionManager



If username is available then it should call userLogged.jsp, instead it always calling invalidLogin.jsp.

Can anyone help me?

Thanking You,
Kasparov
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61105
    
  66

The most like scenario is that the User.isValid() method isn't returning what you expect. What have you done to debug this?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kasparov Patel
Ranch Hand

Joined: Jan 23, 2012
Posts: 40
My observation says it always getting null value for inserted username and password parameters. Since I am trying to find exact problem but not getting. Can you help me?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61105
    
  66

So you have determined that the getParameter calls are returning null? How have you ascertained this?
Kasparov Patel
Ranch Hand

Joined: Jan 23, 2012
Posts: 40
One more important thing I have found is

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Log In failed: An Exception has occurred! java.lang.NullPointerException

I am using netbeans. I guess mysql driver is inbuilt in netbeans. I don't know why I am getting this to exception.
Kasparov Patel
Ranch Hand

Joined: Jan 23, 2012
Posts: 40
Ok I have found solution. I just have to add in libraries. Now it's working. Thanks for help.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61105
    
  66

If the IDE is getting in the way, work outside of it to find out what is wrong. Generally, you need to provide the JDBC driver jar yourself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Always responding invalidLogin.jsp