Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes sendRedirect() not working?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "sendRedirect() not working??" Watch "sendRedirect() not working??" New topic
Author

sendRedirect() not working??

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Hi guys,

I tried the following code below. I had setup Oracle Database. I created a sample login screen just to test how sendRedirect and RequestDispatch works. I have the following,

The code inside my myServler class,



Now, I want my code to behave like this, when the user name and password = xxx and yyy respectively, then I shud be redirected to admin.jsp page rather than landing in welcome.jsp as above. But when I tried this, everytime I land up in welcome.jsp instead of going to admin.jsp when xxx and yyy are my request parameters. Can anyone help me with this please??

Thanks in advance.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Johan Pelgrim
Ranch Hand

Joined: Jul 07, 2003
Posts: 105

Jothi,

When you use

instead of the "String == String" construction it should work...
[ January 05, 2007: Message edited by: Johan Pelgrim ]

Johan Pelgrim, The Netherlands
SCJP 1.4, SCWCD 1.4, SCBCD 5.0
Sreeraj G Harilal
Ranch Hand

Joined: Apr 19, 2006
Posts: 310
try this



SCJP 5.0<br />SCWCD 1.4<br />Preparing for <b>SCEA</b>.<br /><b>"I prefer an interesting vice to a virtue that bores."</b>
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572


This is the problematic code. "==" compares references not contents of String, however String class overrides equals() method to provide the comparison functionality of contents.

Hope it helps
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Guys,

Thanks for the help. Finally it worked!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sendRedirect() not working??
 
Similar Threads
Request Dispatcher probs
Servlet + response.sendredirect & request dispatcher
Invalid user error message
Jsp code doubt
Help with this code!