Not. Servlets are the most convenient way to write a web application in Java. If you think about it: what is a web application? This is just an application that can receive an HTTP request and send an HTTP response. Common models for achieving this are:
- Use some kind of shell that invokes a script for each request. It was the first model and has a standard called CGI (Common Gateway Interface). The wrapper in this case is the web server; or
- To have a constant code inside such a shell that can serve HTTP requests (and not be temporary, like CGI scripts).
There are variations on this topic (e.g. FastCGI for (1)). Servlets are an example (2). The reason 99% of all Java web applications and frameworks use servlets is because servlets are standard (they have a Sun-approved specification and a reference implementation ) and they are so low-level that almost everything you want can be built on top of them.
source share