This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

login servlet = login successful doesn't show

 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 4402
251
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tangara goh wrote:

So, have you ever checked the log?
 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic