IntelliJ Java IDE
The moose likes Tomcat and the fly likes Tomcat Can't See Images or Javascript Subdirectories Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "Tomcat Can Watch "Tomcat Can New topic
Author

Tomcat Can't See Images or Javascript Subdirectories

Scott Farran
Greenhorn

Joined: Mar 10, 2002
Posts: 9
Hello All,
Thanks in advance for your help on this matter. I have installed Tomcat 4.0 and brought over a web app that is running on another Tomcat Server elsewhere no problem. My HTML and JSp's are in an application directory under the root. (as an example accessing this works fine -http://localhost:8080/NewbornNews/index.html)
However the problem I am runniong into is that also in the NewbornNews directory I have two subdirectories named images and scripts. On my server the application cannot see any images or javascript functions when they are in the subdirectories. They are being accessed in very simple ways
<BODY BACKGROUND="/graphics/nbnbgr1.jpg">
or
<SCRIPT TYPE="text/javascript" SRC="/scripts/test.js"></SCRIPT>
Did I miss something in the configuration of my server or set-up of the app or am I missing something really easy?? Do I need a config file for the application?? This same code executes no problem on the production version also running on tomcat.
Thanks Again,
Scott
SCJP
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693


The leading slash in this URL tells the web server (Tomcat in this case) to look for the graphics folder at the root. If this folder is relative to the URL of the current page (this assumes you are doing any servlet mapping in the URL), omitting the leading slash should tell the server to look in the right place.
hth,
bear


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Scott Farran
Greenhorn

Joined: Mar 10, 2002
Posts: 9
Thanks Bear,
I guess when I moved the app one directory lower than the root I needed more than one slash. I will figure it from here.
Thanks Again.
Scott
 
 
subject: Tomcat Can't See Images or Javascript Subdirectories
 
Threads others viewed
Trouble figuring out why Tomcat isn't launching on startup
File System Files Access by Tomcat
File System Files Access by Tomcat
Can't locate .js (or .css) files from a .jsp page.
Using gzip in jsp files
IntelliJ Java IDE