levtatarov
levtatarov

Reputation: 1712

cant find js and css resources - get 404

i have a very simple webapp and cannot get .js and .css files from the server by <script> and <link> tags. error: GET http://localhost:8080/resources/js/lib.js 404 (Not Found)

this is my index.jsp:

<html>
    <head>
        <jsp:include page="/pages/general/scripts.jsp"/>
    </head>
    <body>
        ...
    </body>
</html>

this is scripts.jsp:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="/resources/js/lib.js"></script>

<link rel="stylesheet" type="text/css" href="/resources/css/style.css">

my files:

enter image description here

what am i doing wrong here?

EDIT: btw, i checked and i can easily reach the files by their url. if i access localhost:8080/myApp/resources/js/lib.js then i see the file's content.

Upvotes: 0

Views: 4378

Answers (1)

rai.skumar
rai.skumar

Reputation: 10677

<script type="text/javascript" src="/resources/js/lib.js"></script>

I suspect path is not proper. Try something like src="./resources/js/lib.js"

Upvotes: 1

Related Questions