I am trying to create a table with sortable columns using a javascript library provided by this website. The web application is being created in Java and the table is created but not with the CSS style. I am 100% new to html and javascript and just started trying to learn things today.
I have placed the library in the same source folder as the JSP and also at the root of the project but both times the table is created in standard html format without the script formatting. How should I reference a Javascript library from a JSP in Java Web Application?
I have made some progress but I still cannot get it to work properly. This is my WelcomePage.jsp file:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%response.setHeader("Refresh", "5");%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>title</title>
<script type="text/javascript" src="sorttable.js"></script>
</head>
<body>
<p><a href=url target=\"_blank\">Start</a></p>
<table class="sorttable">
<tr>
<td>text </td>
<td>text </td>
<td>text </td>
<td>text </td>
<td>text </td>
</tr>
</table>
</body>
</html>
I have tried placing it into the META-INF, WEB-INF, and the root folders none of them seem to work correctly. I have also attempted to add it to the web.xml file but nothing seems to work.
Some things I have already tried
Can not include javascript file from WEB-INF directory in JSP.