Search code examples
javaeclipseservletsjakarta-ee

Can't create a Servlet in eclipse


I'm trying to create a servlet in eclipse but when I create the name of the Servlet the finish and the next button don't show up.

I searched a lot in slack and I verified that:

  • My project is a Dynamic Web Project
  • Dynamic Web Module is checked in my Project Propriety
  • I have followed more than a tutorial and the result is the same

Look at this picture Please: enter image description here


Solution

  • Ensure the Dynamic Web Module facet is enabled for your project and try writing the package name when creating a servlet.


    By the way, you don't need a wizard to create a servlet. Just create a class that extends HttpServlet and annotate it with @WebServlet:

    @WebServlet("/hello-world")
    public class HelloWorldServlet extends HttpServlet {
        ...
    }
    

    Then override the doXXX(HttpServletRequest, HttpServletResponse) methods to handle the requests.