Skip to main content

How Servlets work

Step 1: A user using a web browser requests some information from the web server via an http request.

Step 2: The web server receives the request. If the request is for a straightforward HTML page then the appropriate HTML file will be loaded. If the request is to a servlet, then the web container will load and initiate the servlet (unless it was already running). This is done by running the servlet on a Java virtual machine (JVM).

Step 3: The servlets’ init() method is then executed. This method is the equivalent of the init() method defined for applets. That is, it is executed only once, when the servlet is first created. It should be used in the same way as the init() method for applets. That is, as the servlets initialisation method (rather than defining a constructor). The init() method must complete before any requests are handled.

Step 4: The servlet will receive the HTTP request and perform some ty pe of process. Each request is handled by its own thread (lightweight Java process). Depending upon the request one of the following methods will be called to handle the request:

  • doGet – handles GET, conditional GET and HEAD requests.
  • doPost – handles POST requests.
  • doPut – handles PUT requests.
  • doDelete – handles DELETE requests.

Step 5: The servlet will return a response back to the Web server from one of the above methods.

Step 6: The Web server will forward the response to the client.

Step 7: When requested, the web server will terminate the servlet. This may be done by the web server administrator. At this time the destroy() method is called. This method runs only once and is used to “tidy” up any system resources used by the servlet etc. For the servlet to be run again, it must be reloaded by the web server.

Comments

Popular posts from this blog

Installing Bugzilla on Windows

Bugzilla is the Bugs/Issues Tracking Tool from The Mozilla Organization. Version 2.18 is the latest stable release. There are couple of resources which guide a User installing Bugzilla on a Unix/linux machine. However, this entry describes a way to install Bugzilla on a Windows machine (W2K to be precise). This document guides you step by step through the installation process. First, get Administrative access to the machine on which you want to install Bugzilla. It should be a simple step. Usually, Users are given Administrative rights on Windows machine. However, if you dont have, contact your Administrator. Get Bugzilla Then download the Bugzilla from http://bugzilla.org/download.html . There are two ways of gettng it - through CVS or direct downloading the tar file. Remember there are no Zip files. However, any zip utility should be able to untar the Bugzilla. I download the tar file and untarred it using WinZip. I placed the untarred 'bugzilla' directory in my c: drive. So...

Online Hindi Radio Stations

Here is the list of Online Hindi Radio Stations. Copy the URL in your media player and enjoy !! 106.2 HUMFM - UAE ==> http://www.humfm.com/humfm.asx AajKal - Asian Network ==> http://stream.servstream.com/ViewWeb/BBCRadio_music/Event/BBCAsianNetwork_hi.asx Amrit Bani - UK ==> http://62.25.97.192/amritbani?MSWMExt=.asf ApnaRadio - USA ==> http://www.apnaradio.com/live/media24/ApnaRadio.asx Asian Gold Radio - UK ==> http://62.25.96.7/asiangold Asian Sound Radio - UK ==> http://www.vtuner.com/vtunerweb/mms/mms15278.asx BBC News ==> http://www.bbc.co.uk/worldservice/meta/tx/nb/live_news_au_nb.asx BombayBeats FM ==> http://www.1.fm/player/energybbfm32k.asx City 101.6 FM - Dubai ==> http://asx.abacast.com/arabian_radio-city-24.asx DDLive Video - India ==> http://164.100.51.209/ddlive?MSWMExt=.asf DesiSoundz - India ==> http://desisoundz.com:8000 Haagstad Radio - Holand ==> mms://81.205.146.32:21/haagstadradio kismatradio.com ==> http://www.kismatradio....

What are the different type of JDBC drivers?

There are four types of JDBC database driver: The JDBC/ODBC bridge driver (Type 1) A piece of native C-code that translates a JDBC call to an ODBC call. Use this driver for development, not for industrial-strength application environments. Note that you have to have an ODBC database driver manager + an ODBC database driver installed on the server in addition to the JDBC/ODBC bridge. Though useful for learning JDBC and quick testing, bridging solutions are rarely appropriate for production environments. Native API partly java driver (Type 2) A piece of native C-code that translates a java JDBC call to a native database call level API. Use this driver for development and deployment. Due to its native code, this driver can only be used by Java Applications with full computer access (i.e. not Applets). Type 2 drivers generally provide the best performance, but they require the installation of native libraries on clients that need to access the database. Applications using Type 2 drivers ...