Configuring deployment with the web.xml file
In the WEB-INF
folder of a web project, there is usually a file named web.xml
. It was mandatory before the @WebServlet
annotation was introduced. With the annotation, the application server can determine on its own which files are servlets and which are not. There is more that you can do in this file than just list servlets. For this reason, I advise you to always have a web.xml
file.
Our descriptor will be quite basic:
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd" version="5.0">...