title: How include an external JS file in a JSP page
body: <p>I have an spring mvc app where in my main page, I need use an javascript file. I try include the file this way:</p>
  
  <pre><code>&lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>but when I running the application, the system behavior seems like no script is running. T also try this:</p>
  
  <pre><code>&lt;script type="text/javascript" src="&lt;c:url value='js/index.js'/&gt;"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>but the result was the same. Someone have any idea why this  is happening?</p>
  
  <p>ps.: the entire code of my page is:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
    &lt;title&gt;HorarioLivre&lt;/title&gt;
  
    &lt;script src="http://code.jquery.com/jquery-2.1.0.min.js"&gt;&lt;/script&gt;
    &lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;
  
    &lt;link rel="stylesheet" href="css/style-main.css"&gt;
    &lt;link rel="stylesheet" href="css/style-popup.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;header&gt;
      &lt;div class="container"&gt;
        &lt;h1&gt;&lt;a href="#"&gt;HorarioLivre&lt;/a&gt;&lt;/h1&gt;
        &lt;nav&gt;
          &lt;ul&gt;
            &lt;li&gt;&lt;a href="listagem_evento.html" class="icon evento"&gt;Eventos&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="cadastra_horario.html" class="icon horario"&gt;Cadastrar Horarios&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="listagem_horario.html" class="icon horario"&gt;Listar Horarios&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="listagem_usuario.html" class="icon usuario"&gt;Usuarios&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;${usuario.nome}&lt;/a&gt;
              &lt;ul&gt;
                  &lt;li&gt;&lt;a href="usuario_perfil.html" class="icon perfil"&gt;Perfil&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="usuario_config.html" class="icon settings"&gt;Configura&amp;ccedil;&amp;otilde;es&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="usuario_logoff.html" class="icon logout"&gt;Sair&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/nav&gt;
      &lt;/div&gt;
    &lt;/header&gt;
    &lt;div id="results"&gt;
          &lt;a href="#" id="close"&gt;Fechar&lt;/a&gt;
          &lt;div id="content"&gt;&lt;/div&gt; 
    &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The script should open my subpages in a pop-up windows, but they are being opened in the browser window.</p>
  
  <p>** UPDATE 1 **</p>
  
  <p>My index.js is:</p>
  
  <pre><code>$(document).ready(function(){
     setupPopup();
  });
  
  function setupPopup() {
     $('a').click(function() {
         $('#content').load($(this).attr('href'));
        $('#container').append('&lt;div id="cover"&gt;');
        $('#results').fadeIn(500);
        popupPosition();
     });
  
     $('#close').click(function() {
        $('#results').fadeOut(100);
        $('#cover').remove();
     });
  
     $(window).bind('resize', popupPosition);
  }
  
  function popupPosition() {
     if(!$("#results").is(':visible')){ return; }
  
     $("#results").css({
        left: ($(window).width() - $('#results').width()) / 2,
        top: ($(window).width() - $('#results').width()) / 7,
        position:'absolute'
     });
  
     $('#results').draggable();
  }
  </code></pre>