You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brian Kuhn <bn...@hotmail.com> on 2003/05/12 18:57:32 UTC
(OT) Forwarding to another server...
This is a little off-topic, but what is the best way to forward a request to
a page not on your server? I have a servlet that needs to build a url based
on the request, and forward the user to that url. If I use sendRedirect,
some browsers (like mozilla) limit the number of times it will forward to
the new page. I belive you can change this by configuring mozilla, but I'd
rather not have to have my users change their settings just for one page.
Working under the assumption that I also can't use response.forward() to
send the user to a url outside my server, I've come up with the following
cheap hack that does exactly what I need. Can anyone suggest a way to do
this without javascript?
Thanks.
String url = "someurl.com";
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><body onload=\"location.replace(\'" + url +
"\');\"></body></html>");
====================
Brian Kuhn
bnkuhn@hotmail.com
====================
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org