When working on my app, I encountered an issue with including a separate .js file in my .jsp frontend page.
This is how my directories are arranged:
src
|--->com.stuff
|--->servlet.java
war
|-->WEB-INF
|--->pages
|---->page.jsp
include.js
Within my java servlet, I use the code:
RequestDispatcher jsp = req.getRequestDispatcher("/WEB-INF/pages/page.jsp");
This code functions correctly, but within page.jsp, I encounter the following issue:
<!DOCTYPE html>
<html>
<head>
<title>Page</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"type="text/javascript" ></script>
<script src="./include.js" type="text/javascript" ></script>
</head>
<body>
<h1>Page</h1>
</body>
</html>
I have tried multiple variations of "./include.js" and consistently receive the error message from firebug:
"NetworkError: 404 Not Found - http://localhost:8888/include.js"