在Tomcat中部署了一个项目。
当然里面的web-app是tomcat的webapps
,结构如下:
tomcat-home
|--webapps
|
-MyProject
|
-WEB-INF
-startingPoint.js
-client
-other dirs etc
现在 startingPoint.js 是一个 javascript 文件,本质上是在浏览器中加载一个小程序,类似于:
document.write('<OBJECT ');
document.write(' codebase = "jre.exe" WIDTH = "100%" HEIGHT = "100%" MAYSCRIPT > ');
document.write(' <PARAM NAME = CODE VALUE = "com/AnApplet.class" > ');
document.write(' <PARAM NAME = CODEBASE VALUE = "/MyProject/client/classes" >');
document.write(' <PARAM NAME = ARCHIVE VALUE = "/MyProject/client/lib/Appletclient.jar"> ');
document.write(' <PARAM NAME = "type" VALUE = "application/x-java-applet;version=1.6"> ');
document.write(' <PARAM NAME = "MAYSCRIPT" VALUE="true"> ');
etc.
如果我在 IE url 栏中写 url:
http://ip:port/MyProject (当然 tomcat 正在运行)小程序已加载到我的浏览器中,但我不明白如何加载。
我的意思是从 web.xml 中我看不到可以为 javascript 文件提供服务的内容。
如果一个 js 文件在我的项目的 roor 目录中,它会自动提供吗?
我觉得我在这里遗漏了一些东西。
有人可以请教,我应该在这里寻找什么?
谢谢
最佳答案
此 .js
包含在 web.xml
或 index
中指定的 welcome-page
中页面 ,
该页面将被加载,如果包含 js,它将被加载。
关于java - 关于 tomcat 服务 webapps 和 web-inf 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4766895/