• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sendRedirect() not working??

 
Joe Harry
Ranch Hand
Posts: 10109
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jothi,

When you use

instead of the "String == String" construction it should work...
[ January 05, 2007: Message edited by: Johan Pelgrim ]
 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this

 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 10109
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

Thanks for the help. Finally it worked!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic