wood burning stoves 2.0*
The moose likes Servlets and the fly likes login servlet = login successful doesn't show Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "login servlet = login successful doesn Watch "login servlet = login successful doesn New topic
Author

login servlet = login successful doesn't show

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
Hi,

I've tried using a PreparedStatement to verify login userid and password.

My database is using Msaccess and the field for the variable is userid and password. It contains 4 userid and passwords.

However, when I run my servlet, they did not give me the successful login message nor redirect me to the next page. Hope someone can tell me what is wrong with my code. thanks.

Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3060
    
  38

tangara goh wrote:

So, have you ever checked the log?


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
I am sorry but how do I go about checking the log. Even though, I have my friend who helped me to resolve this problem, I still hope to learn how. thanks.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Which server are you using. If it's tomcat, your logs are in the "logs" folder under your tomcat installation directory.

By the way, generating HTML from within your servlet is not the best idea. You may want to read up on MVC.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Are you intending to look for a record with the hard-coded user name and password rather than the values passed in by the client page?

Note the setString() calls. Your setting the 1st parameter to "userid", not the contents of the userid parameter passed to the servlet. The same problem exists for the second parameter.

I think you want:

What response do you get when you go to the page? Do you get either the Login Success or the Login Failed HTML?
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
tangara goh wrote:I am sorry but how do I go about checking the log. Even though, I have my friend who helped me to resolve this problem, I still hope to learn how. thanks.

If you've solved the problem, can you please share the resolution with the rest of us?

Thanks,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: login servlet = login successful doesn't show