That depends entirely on the server you're using. If it's an embedded server like Jetty, then you can easily do that in flavor of a ServletHolder
.
context.addServlet(new ServletHolder(new HelloServlet()),"/*");
If it's other, then you need to consult the documentation of the server in question. It's usually not possible in non-embeddable servers like Tomcat, Glassfish and so on.
See also:
Update: as per the comments on your question, you're after all looking for a solution in the wrong direction. Reread the MVC pattern and more specifically the front controller pattern. You shouldn't use servlets as domain objects, but just simple constructable Java classes which don't extend HttpServlet
. Finally you just end up with a single servlet which constructs/picks the right domain object based on the current request. You can find some insights and a basic kickoff example in this answer.