Stephan van Hulst wrote:
You always need servlets for web applications in Java, unless you're going to write your own HTTP server. Spring requires servlets at any rate. Servlets are used to route the requests to Spring's request pipeline. And web.xml without servlets is pretty pointless because the whole point of web.xml is to configure applications that will run inside a servlet container.
That's not really true. Spring is a very broad framework and you can very definitely write Spring applications without using Spring Web. I use Spring extensively in JavaServer Faces-based webapps. The only mandatory servlet in a
JSF webapp is the FacesServlet, which is not part of Spring in any way. I could say the same about
Struts, which also has its own dispatcher servlet.
In a technical sense, you're always going to have at least one Servlet, because even if you write the app using nothing but JSPs, JSPs are compiled to produce servlets. People somethings try to produce systems that are nothing but JSPs, but for the most part, they're horrible and riddled with scriptlets
In practical terms, just about all
JEE web frameworks have at least one servlet in them, but it's not actually part of the spec or anything. And I suppose you could create an SPA webapp using just a backing JSP and something like React/JS.