You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bob Byron <bb...@radit.com> on 2001/10/05 01:11:12 UTC

Forward to different website.

I need to forward to a different website entirely from inside my servlet.

I tried using the following code:
    RequestDispatcher rd = getServletContext().getRequestDispatcher("//otherwebsite.com/page.html");
    rd.forward(request, response);

But it didn't seem to want to forward anywhere.  I was able to successfully
forward inside my own site though.  But I do need to forward to a different
site.  Is there any way for me to do this?

I am in "http://websiteone.com/someservlet" and want to forward back to
"http://anotherwebsite.com/somepage.html".

Thank You,
Bob Byron


Re: Forward to different website.

Posted by David Wall <dw...@Yozons.com>.
You can't forward across contexts, I don't think.  You can
response.sendRedirect() to any URL if that's all you need.

David

----- Original Message -----
From: "Bob Byron" <bb...@radit.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, October 04, 2001 4:11 PM
Subject: Forward to different website.


> I need to forward to a different website entirely from inside my servlet.
>
> I tried using the following code:
>     RequestDispatcher rd =
getServletContext().getRequestDispatcher("//otherwebsite.com/page.html");
>     rd.forward(request, response);
>
> But it didn't seem to want to forward anywhere.  I was able to
successfully
> forward inside my own site though.  But I do need to forward to a
different
> site.  Is there any way for me to do this?
>
> I am in "http://websiteone.com/someservlet" and want to forward back to
> "http://anotherwebsite.com/somepage.html".
>
> Thank You,
> Bob Byron