General stuff.

Once u submit the request for the URL the web server receives it , the web server locates the web page and sends it back to the browser.

The browser then displays the page.

The Web Browser

Browser is a universal user interface.

The latest must have browser feature is XML
XML allows one to define ones own tag set to charecterize the data and to construct documents and data structures using these tags.

XML provides a way for strutured data to be self describing  and that means the data can be portable.

The Web Server

Web Server is a program running on the server that listens for the incoming requestes and service those requests as they come in.

Once the web server recieves a request, it then springs into action .

Depending on the type of request, the webserver might look for a web page or it might execute a program on the server.

Leading web servers are Apache web server and IIS.

Java servlets can be run using a just about any web server.

- platform independant, because they interface to a particular server architecture through a set of standard interfaces(that make the servlet engine) and a JVM.

Since servlets can be run using a stand alone servlet engine,the web server doesnt necessarily have to support servlets in order for you to make use of them.

Java Servlets are very efficient due to an intuitive threading model in which each request is handled by a new lightweight thread.

Ntier Architecture.

2 tier

The application exists entirely on the client PC while the database
sits out on a server somewhere in the organization.

processing load is given to the PC

Middle Tier of a 3 Tier Architecture

Is basically the code which the user calls upon to retrieve the desired data.The presentation layer then receives the data and formats it for dispaly.This separation of appln logic from the UI adds enormous flexibilty to the design of the application.

The third tier contains the data that is needed for the appln.
This data can consist of any resource of info , including an enterprise db like Oracle or Sybase, a set of XML documents that has been stored in a well formed document conforming to XML specification or even a directory service like an LDAP server.

Not only database there are many different sources of  enterprise data that ur appln can access.

-performance, network traffic, and maintanence , besides others !!! (check) have all been addressed in the 3 tier.

To extend 3 tier to ntier , we simply extend the middle tier by
allowing for mutiple application objects rather just a single appln.

The appln objects must each have an interface which allows them to work together.

With an Ntier architecture, we can have mutiple applications using a common set of business objects across an organization.

Java applets can be used as a client to a server-side program by simply
opening up a socket connection the the web server.

The main problem with applets remains the constrained bandwidth of  most internet access.

Sending the webserver a request

The web browser packs up the user data and issue an HTTP request to the web server.

The three most commonly used methods are HEAD , GET , POST.

The head method simply retrieves information about a document and the document itself.

The GET and POST methods are the ones that u use to issue requests to execute a web program.

Using the GET Method.

In this all the form data that has been entered is appended to the
request string.

The data is appended using key =value pairs (Field names and associated values).

eg would execute a script named
hello.cgi in the cgi-bin directory of the server and pass it a value of
'shri ' for the 'name ' variable.

.cgi-bin/hello.cgi Name andlocation of the server resource

? separates the loaction form the data

key =value Field names and associated values

& separates key = value pairs

+ Replaces the space character.Note that all other special characters are hex-encoded.

GET  is used as the default method for all the web requests.

The browser sees the GET request as just any other URL as all the form data with the request string.

Disadvantages of  GET.

If some previous results for the exact same request URL exist in the cache, then the older results might be displayed.

Another potential problem with using the GET method is that the amount of data that can be passed is limited since it has to be appened to the request URL.


also packs form data as part of the request body.
The server program will be able to read the contents of the input file and parse out the variable names and values.

The POST method allows more data that can be passed and it will always send the
request to the server.

Ideally GET for request,
POST for submitting data .

Executing the server script

The web server first determines which type of OS it needs to load by looking at the extension of the requested file.

all files in CGI bin are of type .cgi.
so is.jsp in html root directory and servlets .class files in the servlets directory,web server takes care of
pulling up all the required files depending on the request.

Once the web server determines the type of the requested file, it then loads any required run time environment for the file to be executed.

For example if a CGI program were written in Perl the web server would create a new process and load the Perl interpreter into it.

Returning the Results to the Browser is done thru HTTP.

Developing Server applications

A server side web program is the same as any other program with a few important exceptions.

To make a program accessible to a web server, it must possess the following characteristics

The program should be able to be invoked by the web server.When a user issues a request from a web browser,the web server has to be able to locate and execute th requested program.

There must be a way in which the web server passes any form data to the program.
Once the program is invoked  there has to be a standard entry point.

After the program has processed the input data, it has to package up the results
and send them back to the web server, which will in turn send them abck to the web browser.

Server Side Technologies


Common Gateway Interface

all web servers provide support for CGI programs
can be written in any lang.
its a gateway between user request and the data that it requires.

Dis adv , each time a req is received , an entire new process is created.

Technologies like FastCGI and Apaches mod_perl help here.FastCGI by sharing single instances of each CGI program .
mod_perl by interpreting and excuting perl scripts within apache web server.

Proprietery web server APIs (ISAPI , NSAPI) are developed to address inefficiencies of CGI.
by Microsoft and NS respectively.

These libraries are designed to be loaded into the same process as the web server and are able to service mutiple request without creating a new process.Either when webserver starts or when they are needed.

If idle for certain amount of time,the webserver will remove it from the memory.Not to worry , it will be reclaimed from temporary pool later when requested by a client of its service.

Libraries do provide an efficient extension to the web server.

These libraries are accessed by multiple users simultaneously,so they need to be threadsafe.This means that they need to be careful of how they access global and static variables.

If a server program causes an access violation,since it is within the same process
as the web server , it has the potential of crashing the entire web server.


ASP disadv is the lack of wide COM support hence reduces efficiency.
COM is a Microsoft proprietory ,which is Component Object Modelling, refer website for more info.

-non visual applet running on the server witha life cycle to it similar to an applet.
When a user issues a request of r a specific servlet, tha tserver will simply use a different thread and then prcess the individual request.This has a positive impact on perfrormance,sincle mutiple requestds do not generate mutiple processes as does a CGI program/Threads need fewer resources and thats an advantage.

Good server implementations will use thread pools to constrain the number of threads that can  be used to service client requests and prevent them from grinding to a halt.

Another adv of servlets is that it runs inside a JVM and hence portable.

Java is accepted as a industry standard for programming the web, well its a language developed for internet.

Features of Java.

Platform independence.

bytecode interpreted by a platform specific JVM on the web server.
So for example if u are running a Macintosh get a JVM for Macintosh and load the bytecode file into it, it runs the same as in another JVM for windows.
JVM is java virtual machine which can read the bytecodes and gets the whole working of a java class program.

better than CGI.When a servlet recieves a user request it simply spawns anothe r thread
with the same process and handles the request.

Enterprise Java APIs

can invoke all java APIs and RMI or CORBA.
Theres a huge list of APIs almost a new one per week,TV API, WAP API, SmartCard API , u just should know
how to make use of those API's.
  ( API is application programming interface, similar to library files in c or cpp)


code reusability is the holy grail of all programing.


Breaking down an appln into discreet modules that are each responsible for a specific task.
It makes appln easy to maintain and understand applications down into tiers and tasks.

More later guys... mail me if u have any queries, otherwise I recommend u to search avidly on internet.