[英]How to give path for external javascript file inside WEB-INF in JSP
I am developing Spring web application. 我正在开发Spring Web应用程序。 my application package structure is
我的应用程序包结构是
web/----|
|WEB-INF/
|-jsps/
|-scripts/
|-styles/
|-web.xml
It is Spring MVC
& maven
based project. 这是基于
Spring MVC
和maven
的项目。 I have to use the external javascript
file in jsp
file. 我必须在
jsp
文件中使用外部javascript
文件。 if I use <script src="/scripts/MyFile.js"/>
is not working as the resource is inside WEB-INF
. 如果我使用
<script src="/scripts/MyFile.js"/>
不能正常工作,因为该资源位于WEB-INF
。 I have tried so many ways but I could not find solution. 我已经尝试了很多方法,但是找不到解决方案。 So could you please tell me how to access
external javascript
file from JSP
file. 所以,请您告诉我如何从
JSP
文件访问external javascript
文件。
Note: I cant change my Directory Structure
as it is specification. 注意:我无法更改
Directory Structure
因为它是规范。 And I should only use external javascript files. 而且我应该只使用外部javascript文件。
So could you please provide solution. 所以请您提供解决方案。 Thanks in adavnce.
非常感谢。
Here is the Some other way: 这是另一种方式:
src="${pageContext.request.contextPath}/jscript/jquery/jquery-1.6.2.js"
We have been using this in our projects. 我们一直在项目中使用它。 Working perfectly.
工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.