title: STS Spring MVC: How to include a JS file in a JSP
body: <p>I installed SpringSource Tool Suite 2.8.0.
  I'm trying to include a JS file in a JSP, using the Spring MVC template as a starting point.
  My JSP looks like this:</p>
  
  <pre><code>&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;%@ page session="false" %&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Home&lt;/title&gt;
      &lt;script type="text/javascript" src="/a.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      Hello world!  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>a.js is under src\main\resources and looks like this:</p>
  
  <pre><code>window.alert("A");
  </code></pre>
  
  <p>The result is that "Hello world!" gets printed without the alert :-(</p>
  
  <p>I tried putting the JS file in different places, changing the src to be with/without "/", and even adding a servlet-mapping in web.xml to use "default" servlet for "*.js".
  Nothing seems to work. </p>
  
  <p>What am I doing wrong?</p>