Solved

External CSS and JS files not included in HTML under Linux

Posted on 2008-10-31
10
727 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

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

There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
This article discusses how to create an extensible mechanism for linked drop downs.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

717 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