either use :
 res.sendRedirect("/page1.html");       // notice the forward slash.

or
 res.sendRedirect("http://yourserver/page1.html";);

Pankaj

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
[Ch.Suresh Babu]
Sent: Sunday, December 30, 2001 11:35 AM
To: [EMAIL PROTECTED]
Subject: res.sendRedirect method in servlets


Hi ,
I'm new to servlets.
I'm writing a small program using servlets.In that servlet I'll fetch
results from the database.Based on the results I'll redirect a html page.
 for that I used this code.
   If(rs.next())
   {
   System.out.println("Before redirecting page1.html ");
   res.sendRedirect("page1.htnl");
   System.out.println("after redirecting page1.html ");
    }
   else
   {
     System.out.println("Before redirecting page2.html ");
     res.sendRedirect("page2.htnl");
     System.out.println("after redirecting page2.html ");
    }
I'm not getting any errors.
But it's not redirecting to any page.but the out put statements are
executing .
What should i to to redirect to page.
Thanks
suresh

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to