File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes response.sendRedirect not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "response.sendRedirect not working" Watch "response.sendRedirect not working" New topic
Author

response.sendRedirect not working

Suleman zia
Ranch Hand

Joined: Apr 19, 2007
Posts: 70
Hello All. I have a servlet by the name of CookieLoginServlet. if the login is successful then another servlet "ContentServlet" will display a Wellcome page. For some reason the webpage stays at the same place and does not forward the request to contentservlet.

Meaning if i enter a correct username and password which exist in mydatabase then a wellcome page will display if not then it will send the login form again stating that the password is invalid. Any clues?

CookieLoginServlet



and here is my contentservlet class


Thanks


SCJP 1.5
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

You need to supply sendRedirect with a valid URL, not just the name of a Servlet.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Suleman zia
Ranch Hand

Joined: Apr 19, 2007
Posts: 70
thanks for the reply. however i tried your suggestion



my mapping seems to be ok also. however i can't post my mapping the forum gives me an error.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
What does the servlet declaration and its mapping look like?


Ping & DNS - my free Android networking tools app
Suleman zia
Ranch Hand

Joined: Apr 19, 2007
Posts: 70
There are too many "<" so i can't replace it with < all the time. is there any other way to display my xml file? i have posted my xml file before also i mean for other post. looks like javaranch have changed recently.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
You can post XML by replacing ">" by "&gt;" and "<" by "&lt;".
Minh Tran
Greenhorn

Joined: Jun 03, 2007
Posts: 19
[Thread hi-jack removed. Minh please start your own topics for your questions.]
[ June 16, 2007: Message edited by: Bear Bibeault ]

SCJP 1.4, SCWCD 1.4<br />email:mobject@gmail.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: response.sendRedirect not working