John, Think about what the browser is doing. When the browser sees file:///C:/Users/OEM/Desktop/testa.text, it wants to load a file from the local system where it is running, which is NOT your Apache + Tomcat server, but the user's machine.
For so many reasons we cannot get into here, you do not what to make it so anyone hitting your site can absolutely reach any file on that server, at least, unless you want a love affair with the hacker community. You want it relative so that 1) Your user's browser can find it and 2) so hackers can't just reach anywhere into your machine and grab something, say... a config file, or a password file. If you need user specific areas, then organize your app directory structure that way, and link relatively to each user's area. Joe -----Original Message----- From: John C [mailto:jac_legend_...@hotmail.com] Sent: Thursday, March 10, 2011 9:21 AM To: users@tomcat.apache.org Subject: RE: Cannot create a link to a file - suspecting tomcat is the issue In case I did not explain myself well. I am trying to create a link to a file in a webpage. The link works fine using Apache + Tomcat if the file and link are both relative. This means that the html file containing the link to the text file is located in the same directory as the file itself. However I would like to link to absolute files anywhere on the system where the Apache + Tomcat server is hosted. In this case I am running on local host and using the absolute link to the file (file:///C:/Users/OEM/Desktop/testa.txt). Unfortunately this doesn't work. Any idea what I am doing wrong? > From: jac_legend_...@hotmail.com > To: users@tomcat.apache.org > Subject: Cannot create a link to a file - suspecting tomcat is the issue > Date: Fri, 11 Mar 2011 04:07:47 +1300 > > > I am trying to create a link to a file in my webpage. The anchors href for the link is "file:///C:/Users/OEM/Desktop/testa.txt". When I run my webpage from file I can click the link (file:///C:/Users/OEM/Documents/NetBeansProjects/WebApp/web/main.htm). However when I run my webpage using Apache Server and Tomcat I cannot click the link (http://localhost:8080/WebApp/main.htm). What I am trying to achieve is to be able to create a link to a file located anywhere on the server. Since I am using localhost, I would like to point to this file (file:///C:/Users/OEM/Desktop/testa.txt). How do I do this? Does the file have to be relative to Apache Server? > Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org