my dog learned polymorphism*
The moose likes Servlets and the fly likes servlet sendRedirect() 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 "servlet sendRedirect()" Watch "servlet sendRedirect()" New topic
Author

servlet sendRedirect()

jodi blair
Greenhorn

Joined: Apr 12, 2001
Posts: 14
I'm trying to pass arguments to a new page by placing the url in the sendRedirect method. It doesn't throw an error but just stops. What do you think could be wrong? The url is correct but it doesn't even get to the doGet()! The url works if I type it into the browser manually. Thanks for any help!
jodi blair
Greenhorn

Joined: Apr 12, 2001
Posts: 14
Could somebody reply to this? Is it just a dumb or confusing question? I just need some suggestions as to what could be wrong! Thanks
jodi blair
Greenhorn

Joined: Apr 12, 2001
Posts: 14
Well, I figured it out -- I accidentally had debug statements using a connection object, not good! Take 'em out and it works.
Zoe Peng
Ranch Hand

Joined: Nov 27, 2000
Posts: 112
Why? I think you still need the connection object?
jodi blair
Greenhorn

Joined: Apr 12, 2001
Posts: 14
I was talking about the output stream. i was using it to print out debug statements. Once it is at the browser(printing the debug statements), you can't redirect. By connection object, i meant a custom made-connection object, and I meant take the debug statements out -- sorry to confuse
sujit kolte
Greenhorn

Joined: May 10, 2001
Posts: 1
When you use sendRedirect in Servlet your response and Request are not carried forward to next page .
Use RequestDispatcher ..
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatche("URL");
rd.forward(req,res);

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet sendRedirect()