I am developing a small web application application. The objective is to create one welcome index.html
page with Ajax + one servlet to handle ajax requests.
Although I thought I would be fine with a web.xml
only, I don't want to deploy to /
, but to /MyApp
. NetBeans's project properties offers options to set a context path, which helps me deploying to /MyApp
. However, it automatically adds a /META-INF/context.xml
file, which is a bit confusing.
My questions are:
1) Do I really need a context.xml
file do deploy to /MyApp
instead of /
?
2) If answer to 1) is no, how to accomplish the same with web.xml
only?
3) What is exactly context.xml
to web.xml
?
/META-INF/context.xml
is a Tomcat-specific config file. It's used to configure how your app is deployed to Tomcat, including, among other things, the context path at which it exists. Other containers have similar files that can be included in a WAR for container configuration. To answer your questions: