admin管理员组

文章数量:1391969

There are link problems when loading resources. Can't figure out why.

I have a song-history.js file in /component folder and I'm trying to load it:

<script src="/components/song-history.js" type="text/javascript"></script>

But I'm getting an error :

GET http://localhost:8080/components/song-history.js net::ERR_ABORTED 404 (Not Found)

The same with images that are /icons folder.

<img id="img" src="/icons/up.png">

And I'm getting:

GET http://localhost:8080/icons/equal.png 404 (Not Found)

Here's my directory structure:

I tried renaming folders, moving them, moving files to the root - nothing helped. When I'm trying to open links, e.g. http:// localhost:8080/icons/re.png I get the message

Type Status Report
Message JSP file [/icons/main.jsp] not found
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

I'm not sure why it's even searching for main.jsp there.

Can anyone help? :)

UPD: I replaced

<script src="/components/song-history.js" type="text/javascript"></script>

with

<script type="text/javascript"><%@include file="/components/song-history.js"%></script>

and it worked, but I don't know what's wrong with the first way and how to make it work with images.

本文标签: javascriptFailed to load resource 404 error Can39t load images or js filesStack Overflow