The Servlet 2.1 API unequivocally states that relative URLs are not
permitted with response.sendRedirect(). See the following API link:
http://java.sun.com/products/servlet/2.1/api/javax.servlet.http.HttpServletResponse.html#sendRedirect(javax.servlet.http.String)

But you know what? You are right! It seems you can indeed use relative
URLs with sendRedirect(). I am now not sure whether this is a bug or an
unintended 'feature'...  :->

I have appropriately modified the FAQ entry. Thanks for pointing it out.

Govind

Khurram Mahmood wrote:
>
> I think jguru is wrong about this one. I have been using sendRedirect() with
> relative URL's and it works fine.
>
> KM
>
> -----Original Message-----
> From: Govind Seshadri [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 02, 1999 12:06 PM
> To: [EMAIL PROTECTED]
> Subject: Re: AW: Redirection to another page
>
> The response.sendRedirect() accepts only a fully qualified URL.
> For handling relative URLs see the following jGuru JSP FAQ entry:
>
> http://www.jguru.com/jguru/faq/view.jsp?EID=376
>
> hth,
> Govind
>
> "Bernard, Frank" wrote:
> >
> > > Is it possible to write JSP code to redirect the browser to open a new
> > > page,
> > > say, page B from JSP code in page A?
> > >
> >         use:    response.sendRedirect ( target_URL );
> >
> >         Frank Bernard
> >         Healy Hudson AG
> >         CDT - Core Development Team
> >         67691 Hochspeyer, Nelkenstr. 43
> >         Tel.: 06305 / 92 11-804, Fax: 06305 / 92 11-60
> >
> >
> ===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > FAQs on JSP can be found at:
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
>
> --
> Govind Seshadri <[EMAIL PROTECTED]>
> Enterprise Java Guru
> jGuru.com - The Java Portal
> http://www.jguru.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html

--
Govind Seshadri <[EMAIL PROTECTED]>
Enterprise Java Guru
jGuru.com - The Java Portal
http://www.jguru.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to