不能在JSP中包含来自WEB-INF目录的javascript文件。 [英] Can not include javascript file from WEB-INF directory in JSP.

查看:111
本文介绍了不能在JSP中包含来自WEB-INF目录的javascript文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用tomcat在jsp中将文件包含在以下文件夹WEB-INF \includes \ header.js中。我在jsp文件中包含以下内容但它不起作用

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>

。它没有得到header.js,当我查看源并尝试点击src链接时,它说资源未找到404错误。

". 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.

推荐答案

<script type="text/javascript">
<%@include file="../foo.js" %>
</script>

foo.js在WEB-INF / jsp下,文件包含在WEB-INF /下jsp / common

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

这篇关于不能在JSP中包含来自WEB-INF目录的javascript文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆