3

my index.html and my app .js are located in different folders

- WEB-INF
  --resources
    -js
      -app.js
  --views
    -index.html

I tried to import my app.js into my index.html using :

<script src="../resources/js/app.js"></script>  

but it didn't work . I got this error :

GET http://localhost:8080/projectname/resources/js/app.js

3
  • can you give the full path, which works for app.js? Commented Jan 20, 2016 at 9:26
  • is that file/folder readable by apache? Commented Jan 20, 2016 at 9:26
  • You should consider the start point as reference, not your view's index.html path. Edit your question and provide the full structure if you want more help on this Commented Jan 20, 2016 at 9:32

1 Answer 1

0

Unless you use some IDE like VisualStudio, etc.

Files on your site's root folder are referred like this: src="/[fileInYourRootFolder]"

So files on a subfolder are referred like this:src="/[subfolder]/[fileInSubfolder]"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.