I am trying to foward a jsp page in my servlet to teste to see if my Connetion to the database is working. I put the forward with the page but .I start the tomcat and put my user and pass but I dont donw if it is working because I am not being able to call the success page.
Based on your code above either the request will be forwarded to the "success.jsp" or "retry.jsp". And based on your logic it should always go to "retry.jsp" more times than not.
You are comparing your request parameters with empty(DbUserName and DbPassword) strings. Also you are not querying your database to see if the username and password even exists in the database.
What are the messages are you seeing.
posted 16 years ago
I want this. My login page calls the Servlet to check if the username and password matchs the user input with the database. I did a success page in the loop to see if it wors in red but nothing comes up. The code compiles fine but I think the Servlet class is not calling the databse??
I just saw that my username and password is empty but my intention is to get the strinb username and password in the table in the database.
So does anyone knows how or wher to get tutorials??
I come up with this inside the post method
SO what you think?? And how I do I do to get the string inside the table in the columns username and passord to compare with the user input??
Frankly, no. You are making some very basic JDBC mistakes that going through a basic tutorial should help you solve. If you are not going to put at least that much effort into it, why should you expect people to put effort into helping you?
I think you may be getting an Exception while loading the driver or may be getting the null connection. Try to print the exception to a log file and see what exception you are getting. Becoz by looking at your code if an exception is thrown it will go to catch block and you will not be able to execute the lines for forwarding to other page.