wood burning stoves
The moose likes Servlets and the fly likes sendRedirect() to ROOT in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "sendRedirect() to ROOT in tomcat" Watch "sendRedirect() to ROOT in tomcat" New topic

sendRedirect() to ROOT in tomcat

Kevin Wright
Ranch Hand

Joined: Jul 10, 2001
Posts: 38
I am running tomcat 3.2.2
I want to use the HttpServletResponse.sendRedirect method to send somebody from a servlet to a (jsp)file in my ROOT directory. If I fully qualify the path name, I get an error because the servlet looks in the "\servlet" directory first. This is what I get ("/servlet/C:/jakarta-tomcat-3.2.2/...".) How would I fix this?
Tony Alicea

Joined: Jan 30, 2000
Posts: 3226
sendRedirect() is executed by the browser so the URL given has to be one in a format that is reachable from the public Internet. The browser doesn't know about your C dive.
You would have to map your C:\ drive to some URL in the app (or HTTP) server. Or something like that

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
I agree. Here's the link: http://aspose.com/file-tools
subject: sendRedirect() to ROOT in tomcat
It's not a secret anymore!