• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
9 views

Problem :

I am unable to solve my link problem. Can anybody help on to this to link the CSS and JS File?

I am facing below error :

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/jquery.multiselect.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/style.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/prettify.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/jquery.multiselect.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/RetailSmart/jsp/Jquery/prettify.js

 

by (7.5k points)  

1 Answer

0 votes

Solution :

Please note your failing URL:

Failed ... http://localhost:8080/RetailSmart/jsp/Jquery/jquery.multiselect.css

Now you need to examine one of your links:

<link href="../Jquery/jquery.multiselect.css" rel="stylesheet"/>

Here "../" is a shorthand for "The containing directory", or a "Up one directory". This is the relative URL. And I guess, you have the file in /jsp/<somefolder>/ which contains a <link /> and <style /> elements.

So I recommend you to use an absolute URL as below:

<link href="/RetailSmart/Jquery/jquery.multiselect.css" rel="stylesheet"/>

The reason behind using the absolute url is that I'm guessing that your links are contained in some of the common file and if you try to correct your relative paths by adding the second "../", then you may break any files contained in the /jsp.

by (34.4k points)  
...