1

How to include a file in the following folder WEB-INF\includes\header.js in jsp using tomcat. I have the included the following in jsp file but it does not work "

<script type="text/javascript" src="WEB-INF/includes/header.js"></script>

". It is not getting the header.js and when i view source and try to click on the src link it says resource not found 404 error.

Sazzadur Rahaman
  • 6,938
  • 1
  • 30
  • 52
Abdus Samad
  • 343
  • 2
  • 12
  • 27

2 Answers2

4

Put a "/" before "WEB-INF" like this,

<script type="text/javascript" src='<c:url value="/WEB-INF/includes/header.js"/>'></script>

and it will work fine. :)

Sazzadur Rahaman
  • 6,938
  • 1
  • 30
  • 52
2
<script type="text/javascript">
<%@include file="../foo.js" %>
</script>

foo.js is under WEB-INF/jsp and the file include it is under WEB-INF/jsp/common