Servlets are Java server-side programs that accept client’s request (usually http request), process them and generate (usually http response) responses. The requests originate from client’s web browser and are routed to a servlet located inside an appropriate web server. Servlets execute within a servelt Container which resides in a web server like Apache Tomcat. The newer release of Tomcat has a JSP (java server pages) container also in it. Normally HTTP (hyper text transfer protocol) is used between web client and servlets, but other protocols like FTP (file transfer protocol) can also be used.Life Cycle of Servlets
Servlets have their own execution life cycle. The lifecycle includes three methods:
Whenever a client request is received by the servlet container (part of a web server)
- Locates the servlet responsible for handling the request and loads it.
- Instantiates it.
- Initializes the servlet by calling intit () method, followed by service and destroy.
method is called only once during the lifetime or an applet. One time initializations are done in this method.
Edited by BenW, 10 October 2012 - 10:18 AM.
Fixed thread title