Reputation: 8128
Are servlets the only way one can write web applications in Java ?
Upvotes: 4
Views: 348
Reputation: 9086
That servlets are most convenient way to write Web apps in Java is arguable. They certainly have been around for a long time, but there are alternatives; take a look at restlets for example: http://www.restlet.org/
Upvotes: 0
Reputation: 625007
No. Servlets are just the most convenient way to write a Web application in Java. If you think about it: what is a Web application? Quite simply it is an application that can receive an HTTP request and send back an HTTP response. Common models for achieving this are:
There are variations upon this theme (eg FastCGI for (1)). Servlets are an example of (2). The reason 99% of all Java Web applications and frameworks use servlets is because servlets are standard (they have a specification endorsed by Sun and a reference implementation) and they're so low-level that pretty much whatever you want can be built on top of them.
Upvotes: 11