I’m trying to use this little script I found here, but for some reason it’s not working and I can’t figure out why.
My head tags in browse.jsp :
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Parcourir les livres</title>
<script type="text/javascript" src="../../JS/sortable.js"></script>
</head>
My table, in the same page of course:
<table class="sortable" id="sortabletable">
<thead>
<th>Aperçu</th>
<th>Titre</th>
<th>Éditeur</th>
<th>Auteur</th>
<th>Prix</th>
</thead>
<%
for(Livre livre : livres){
%>
<tr>
<td>Image</td>
<td><% out.println(livre.getNom()); %></td>
<td><% out.println(livre.getEditeur()); %></td>
<td><% out.println(livre.getAuteur()); %></td>
<td><% out.println(livre.getPrix()); %></td>
</tr>
<% } %>
</table>
I don’t think it comes from the src path since I tried to put the .js in the same directory as my page. Anyway here’s my tree
Thanks
Probably your path to the javascript is wrong. Without knowing your application I cannot give you the exact path.
Its probably
JS/sortable.jsor../JS/sortable.js. Files within the WEB-INF directory can’t be accessed directly. So you don’t have to figure out the path from your project structure. You have to figure it out from the pathes at runtime.You could try to use an absolute path as well.