Have you created Dynamic Web Project and created servlet and still are you missing
web.xml file under
Eclipse allows you to NOT create a web.xml file when you create Dynamic Web Project for Java EE 6, since the Java EE 6 spec (in general) and Servlet 3.0 spec (in particular) attempt to de-emphasize deployment descriptors.
You can use annotation to provide all the data that had been included in the web.xml file. You should read through the Servlet 3.0 spec from the jcp.org site to get a bit more explanatory text.
To change the url-mapping for a Servlet 3.0 servlet, the first place to look is in the source code for the servlet. Look for (and change) the value of the urlPatterns element.
If you are trying to create a web app based on Servlet 3.0, try to avoid creating a web.xml file.
But still if you need
web.xml then you can do it by
- Dynamic Web Project
- Right Click
- Java EE Tools
- Generate Deployment Descriptor Stub
You should see
web.xml file immediately after that.
Now it’s time to deploy project to Tomcat Web Server. Right click on Server and click
Add and Remove.
Then add your recently converted Dynamic Web project to
Configured section at right and you should be all set.