开发者

question on tomcat for serving of webapps and web-inf

开发者 https://www.devze.com 2023-02-05 22:11 出处:网络
There is a project deployed in Tomcat. The web-app of course in is webapps of tomcat and the structure is as follows:

There is a project deployed in Tomcat.

The web-app of course in is webapps of tomcat and the structure is as follows:

tomcat-home
|--webapps
       |
        -MyProject
                 |
                  -WEB-INF
                  -startingPoint.js
                  -client
                  -other dirs etc

Now startingPoint.js is a javascript file that essentially loads an applet in the browser and is similar to this:

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.

If I write in the IE url bar the url:

http://ip:port/MyProject (tomcat is running of course) the applet is loaded in my browser but I can not understand how.

I mean from web.xml I can not see s开发者_JAVA技巧omething that would serve the javascript file.

If a js file is in the roor directory of my project, does it get automatically served?

I feel I am missing something here.

Could someone please advice, what is it here I should be looking for?

Thanks


Either this .js is included in your welcome-page specified in web.xml or in index page ,

That page will get loaded and with that if js is included it will load.


The index.jsp (or any file configured in the <welcome-file-list> located in the root of the web application is served by default.

If you don't have such a file, it depends on another settings whether to show a listing of the directory, or deny access.


Hi Another approach could be, You just write a index.jsp/ index.html. Include your js in the file.

Call .js on

<body onload=foo();>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号