Switch to Servlet 3.0 (Apache Tomcat 7.0, Glassfish 3, etc.), then you need to add @WebServletannotations to the servlet class.
@WebServlet("/foo")
public class FooServlet extends HttpServlet {
}
What is it.
If you still adhere to Servlet 2.5 or later, you need to create the Servlet class as a Servlet class, and not as a Java class. In the Rightclick project, choose New> Servlet and complete the wizard. Thus, Eclipse will automatically generate the required display web.xml.

source
share