tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <>
Subject Re: Relative internal links
Date Wed, 04 Jun 2008 23:03:31 GMT

----- Original Message ----- 
From: "Walter Thompson" <>
To: <>
Sent: Wednesday, June 04, 2008 11:25 PM
Subject: Relative internal links

>I have run into an issue with Tomcat6. In Tomcat5 we were using links
>like "../webapps/MCRCServlets/logs/MCRCServlet.log" in the Java Code.

>I copied all of the folders over from Tomcat5 to Tomcat6 so that they
>have the same directory structure:

>           webapps
>                     root
>                      MCRCServlets
>                        Balancer

>In all of the Java Code for the servlets and config files I have had to
>put absolute paths in like
>"C:/www/Tomcat6/MCRCSerlets/logs/MCRCServlet.log" for it to find the

>Is there a configuration file that I can change to make the relative
>references work? What would the config code would I add?

>I have searched everywhere for an answer to this quest and found no

>Thanks for any help anyone can offer!

When using links relativeness to the page or webapp root should work.
and are normally used in this format.
<a href="<%=request.getContextPath()%>/some/file.txt">Blah Blah</a>

Relative links in files is another story... thats relative to to working 
So for example
File f = new File("./somefile");
is relative to the "working path".

If you look at the service manager on windows, under the startup tab is the 
working path.
But on windows if say a user sets up a short cut link and starts the bat and 
the path is now set differently,
then it all changes again.

If you use NB, you will see that under the run tab there is a place to set 
working paths, for this reason.
Its relative ;)
Perhaps the relative path is different between 5 and 6... havnt checked, but 
in general its not the kind of thing I like doing... rather base your file 
on the context real path... that way the user cant screw it up.

Good luck 

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message