Can not include javascript file from WEB-INF directory in JSP. - Stack Overflow

How to include a file in the following folder WEB-INFincludesheader.js in jsp using tomcat. I have th

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.

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.

Share Improve this question edited Nov 24, 2012 at 15:12 Sazzadur Rahaman 7,1161 gold badge32 silver badges53 bronze badges asked Dec 5, 2011 at 20:30 Abdus SamadAbdus Samad 3533 gold badges13 silver badges29 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 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. :)

<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/mon

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745101296a4611289.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信