Tomcat7 supports the Servlet3 specification by default, while the Servlet3 specification supports annotations by default. Therefore, when Eclipse creates Dynamic Web Project, web.xml will not be generated by default, and web.xml will not be referenced manually created.
If you want to use the new Servlet3 specification, you need to use web.xml. Then the following methods can be taken.
Method 1:
When creating a project, click the Next button and do not click Finish.
Until the Web Module, check "Generate web.xml deployment descriptor".
The project created in this way will automatically include web.xml.
Method 2:
If you forget to check it when creating a project.
Right-click the project and select Java EE Tools -> Generate Deployment Descriptor Stub.
Eclipse will automatically add web.xml.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.