Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forward pages with Servlets

 
campos teixeira
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All!

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.

SO What is wrong??



Any Help Please!!

Thanks
 
Craig Jackson
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well a little more information would be helpfull.

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.

Craig.
 
campos teixeira
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before doing anything else you need to get some JDBC basics under your belt. Find a JDBC tutorial and work through it. Here's one that I found with a three second google search.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are some Sun resources.
[ May 31, 2004: Message edited by: Bear Bibeault ]
 
campos teixeira
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply!

Will have a look at it?


bye
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
campos teixeira
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice reply hein?
 
Srikanth Reddy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic