javascript - Eclipse - How do I publish non-Java resources without a web.xml file? -


webapp servlet (@WebServlet) uses java annotations to map URLs and I do not have

file I want to forward the request for an HTML file and I liked it so much.

request.getRequestDispatcher ("/ web-INF / test / testpage.html") forward (request, response);

This works, but I can not get additional resources (javascript) from the server.

& lt; Script type = "text / javascript" src = "testsuite.js" & gt; & Lt; / Script & gt;

is located in testuite.js /WEB-INF/test/testsuite.js, the folder as a single testpage.html. I get 404 when requesting testuite.js. How can I configure tomcos to serve all the resources of my work tree without webcam? The worst case I will just embed JS

In addition, I will install the Web server on my local machine, so I do not know how they are deployed.

You must transfer resources outside of your WEB-INF folder There is a special folder for compiled Java code, jar, configuration files etc.

The web-INF folder is restricted to server and servlet containers for security reasons, for example /appname/WEB-INF/web.xml A request for will definitely be removed.

Static resources such as *. Html files, *. CSS files, *. Files, images etc. should be excluded from the WEB-INF folder, in your case Web-INF .


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -