简体   繁体   English

为什么我无法从浏览器中看到我的js文件-tomcat 7

[英]Why i can't see my js file from browser - tomcat 7

I deployed my ROOT.war to Tomcat webapps folder. 我将ROOT.war部署到Tomcat webapps文件夹。 When I'm writing in a web browser address www.exampleaddress.com I can see index.jsp file. 当我在Web浏览器地址www.exampleaddress.com中书写时,我可以看到index.jsp文件。

But in the same folder is file.js. 但是在同一文件夹中是file.js。 I Would like to see it when I write address: www.exampleaddress.com/file.js but now i can see only empty white page without any code. 当我写地址:www.exampleaddress.com/file.js时,我希望看到它,但是现在我只能看到空白的空白页面,没有任何代码。 Any ideas? 有任何想法吗?

You can't place JS files or any publicly accessible data inside the WEB-INF folder. 您不能将JS文件或任何公共可访问的数据放在WEB-INF文件夹中。 You need a JS folder in the same directory as your WEB-INF folder and that is where you place them. 您需要在与WEB-INF文件夹相同的目录中放置一个JS文件夹,在该目录中放置它们。 The same goes for your .css files and your images. .css文件和图像也是如此。 None of that can be seen from inside WEB-INF. 从WEB-INF内部看不到这些。

/WebApp/CSS/index.css /WebApp/CSS/index.css

/WebApp/JS/index.js /WebApp/JS/index.js

/WebApp/WEB-INF/index.jsp /WebApp/WEB-INF/index.jsp

/WebApp/Images/logo.png /WebApp/Images/logo.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM