0

Setup

Basically I have a set of Javascript inclusions like this inside of my JSP:

<script type="text/javascript" language="Javascript" src="/resources/javascript/core.js"></script>

Problem

However when I load this page I get an error saying:

http://localhost:8080/resources/javascript/core.js is not found (404)

Question

  • Why is the '/' relative referencing causing resources folder to be referenced inside the localhost:8080 and not localhost:8080/myapp/resources?
Ace
  • 1,501
  • 4
  • 30
  • 49
  • Why would it magically add another folder ? – adeneo Mar 17 '14 at 00:56
  • @adeneo I would not expect it to magically add another folder. But why is the root context not my app main directory? Instead it is localhost. – Ace Mar 17 '14 at 00:57

1 Answers1

0

Because you are not specifying it. / means that you want your path to start at the root which is always localhost (considering using local server) You can either use:

/myapp/resources.. //and so on

or use ../ notation which will move you one folder upwards (less error phrone) mainly during the shifting of files from one location to another.

Matúš Dúbrava
  • 771
  • 5
  • 18