Solved

External CSS and JS files not included in HTML under Linux

Posted on 2008-10-31
10
724 Views
Last Modified: 2013-12-02
My Javascript and CSS files are not being referenced by my HTML file when running under Linux. Under Windows, all is fine and everything works. I've checked case on all files. I'm running Tomcat 6.0 on Windows and Tomcat 5.5.20 on Linux.

HTML code snippet:

 <jsp:include page="js/globals.js" />
<jsp:include page="js/transferScan.js" />
<link rel="stylesheet" href="css/softRetail.css" type="text/css" media="screen" >

Any thoughts?
0
Comment
Question by:softechnics
  • 7
  • 3
10 Comments
 
LVL 1

Expert Comment

by:peter-blackwood
ID: 22852650
Since you don't have a leading slash in front of "js/globals.js", Tomcat is trying to find the referenced files using a path name relative to the current JSP page.  (i.e. the one containing the includes)  That's probably why they can't be found.  If you use a leading slash, i.e. "/js/globals.js", Tomcat will resolve it using the Web context, i.e. as if it were an HTML page.  
0
 

Author Comment

by:softechnics
ID: 22852701
The directory 'js' is under the current directory.
0
 

Author Comment

by:softechnics
ID: 22852745
Tried putting '/' at start of pathname, but, as expected, no change.

Thanks for the suggestion. I welcome any others.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 1

Expert Comment

by:peter-blackwood
ID: 22852866
Your original post said the "HTML" code snippet - I'm assuming you meant it's a JSP file, correct?  

Are you creating a war and FTP-ing it to the Linux server or are you copying loose files?

0
 

Author Comment

by:softechnics
ID: 22852894
Yes, they are JSP files. And, yes, I had just copied the 'loose' files to the directories. I am now editing those files in place.

problem?
0
 

Author Comment

by:softechnics
ID: 22853045
To clarify our installation of Tomcat, our SysAdmin installed Tomcat under an existing Apache web server installation. He did this so the tomcat webapps could be referenced via port 80 (I THINK that was the reason he gave me some months ago.) Hence,a tomcat directory exists under the Apache htdocs directory.

Therefore, the URL to my webapp is: http://<Company URL>/tomcat/webapps/<My WebContext>/transferScan.jsp

Hope this keeps things on track.
0
 

Author Comment

by:softechnics
ID: 22853328
I have opened up the JSP servlet in web.xml under tomcat/config. Do I need to do anything else to activate JSP page processing? I ask, because when I try to open the tomcat index.jsp page in tomcat/webapps/ROOT/, I get an error "The XML page cannot be displayed" and it points to the line:
<%@ page session="false" %>
Like it doesn't understand the JSP tags.
0
 
LVL 1

Accepted Solution

by:
peter-blackwood earned 500 total points
ID: 22853931
Sounds like you might benefit from a full reinstall of tomcat.   Try to get the manager app working first (http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html) then imitate that configuration for your own code.

My style of working is to get my app working on my workstation first (sadly, that would be Windows) using http://localhost:8080/blah/blah and when it works as expected, build a war file and deploy the war file to the server.  Often just building a war using ant, maven, or eclipse will catch errors in your project structure that can cause issues when deployed.

Sorry I can't be more helpful.
0
 

Author Comment

by:softechnics
ID: 22853955
Good suggestion. So good, in fact, that I've been moving that way this afternioon. Downloaded v6.0.18 and deployed it. Now setting up appropriate links. My Unix/Linux is rusty, so progress is slow.

Thanks for the replies. They got me thinking.
0
 

Author Closing Comment

by:softechnics
ID: 31512100
You got me thinking in the right direction. Points are yours.
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question