What are servlets?
Servlets are server-side Java applications, as opposed to client-side applets or standalone applications. While servlets are compatible with many different types of servers, typically they are used in web servers, as a replacement for CGI scripts or Active-Server Pages (ASP). Java servlets offer many advantages over other forms of server-side processing. Apart from the obvious (they are written in the Java programming language, a big plus after all), servlet based applications are far easier to write than CGI scripts. There’s no need to write code for parsing HTTP request parameters, as this code is provided by the javax.servlet.http package. You have access to the entire Java API, with no networking restrictions (making servlets far more attractive than applets). There are also performance increases over CGI scripts, as servlets persist over time, and do not create a new process for every connection.