Solved

External CSS and JS files not included in HTML under Linux

Posted on 2008-10-31
10
726 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Open dialog with server side controls in it 3 46
Reactjs with .NET 3 78
Table doesn't show the lines! 3 24
Calculating percentage 2 30
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

733 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