aspose file tools*
The moose likes Servlets and the fly likes Forward pages with Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Forward pages with Servlets" Watch "Forward pages with Servlets" New topic
Author

Forward pages with Servlets

campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
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

Joined: Mar 19, 2002
Posts: 405
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

Joined: May 23, 2004
Posts: 51
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

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Here are some Sun resources.
[ May 31, 2004: Message edited by: Bear Bibeault ]
campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
Thanks for the reply!

Will have a look at it?


bye
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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

Joined: May 23, 2004
Posts: 51
Nice reply hein?
Srikanth Reddy
Greenhorn

Joined: Jun 05, 2004
Posts: 10
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.


Srikanth<br />SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Forward pages with Servlets