We are all very familiar with dynamic web applications. Web application is serve the response based on user request and it can give the dynamic response.
The following is web application introduction please go through it first.
Different technologies are in the world to develop dynamic web applications. We have many technologies from different languages.
The following are popular dynamic web application development languages.
Java, PHP, .NET, Python, Ruby and Perl |
Now we will talk about java language. Our objective is to develop web application in java language.
What is java?
Java is object oriented programming language which has many libraries to develop many applications.
In java we can categorize application in two types
Standalone Application
Web based applications
Standalone Application
Stand alone application are kind of application which have its own client and server. This application should have their independent environment that should run applications. In this application have their own protocol to communicating client and server.
If we develop any application as standalone in each machine we should install client application that will connect with server.
This application we can develop in Java by using Swings.
Example:
Super market Billing application and Hotel billing applications
Web Based Applications
Web base application also need client i.e. browser. When we develop any web based application we need not to have any special client and it will run in web browsers. These applications will work request and response based mechanism using Http protocol.
We already know web application required web browser and browser can understand only HTML and Java Script language.
When we talking about web application that need following artifacts
- Client/Browser
- Server
- Server Side Components
- Containers
Client/Browser
A client is program that able to send request t the server and able to view to end user. In web application browser is client. Browser knows only html and java script. So server response should be browser understandable language.
Server:
Server is a program that will manage resources and that will provide environment to process client request. Server can communicate by using http protocol with client.
When client send request server will generate response and that response should understand by client i.e. HTML, images and files.
Server Side Components:
Server side components are special kind of programs that will prepare the dynamic response when the client is requested.
Server only can serve the response but it can’t prepare the response that is why we need some special program that will prepare response.
Here server will provide environment to run server side components with help of other programs that is called containers.
Containers
Containers is also like server but its have some specialize characters and it will provide platform to run server side components to prepare dynamic response. It will manage the life cycle of components
Java Server Side Components
To implement server side components we need some technology. Java also has server side technology to develop dynamic web application that is called Servlet.
If we want develop any dynamic web application we need server side components that can generate the dynamic response. Java has server side technology to develop dynamic web application using servlet.
What is servlet?
Servlet is server side component which will prepare the dynamic response when client is request.
Java people have given some set of rules when we implement servlet technology this rules are called API.
What is API?
Application Programming Interface (API) is set of rules and specification for technology.
So Java People have given set of rules and specification to servlet so that any vendor to implement servlet that should meet the API specifications.
We have many specifications in java like servlet specification is one to develop web applications
Anyone can implement API specification such people we will call it as Vendors.
A vendor is a company or person who can follow the API specifications and develop the software is like implementation provider.
Some implementations are Enterprise and some are Open Source.
How does servlet work?
To work or run servlet we need servlet container that is responsible to run servlet when client is request for response.
Servlet container will come with many servers so that many servers can run servlet.
The following are the popular servers in the market which can provide run time environment to servlet
.
Tomcat, JBoss, GlashFish, Jetty, Webspear, Weblogic and Pramathi |
The following screen to show servlet work flow.
Servlet execution flow
- Client will send the http request to the server and server will identify the request type.
- If the request type is static then server itself processes the request and server the response.
- If the request type is dynamic then server will delegate the request to servlet container. Now servlet container will find the name servlet to be executed from the request.
- Container finds the servlet then it will execute the appropriate servlet and servlet will prepare the dynamic response.
- Now container give the response back to web server then web server serve the response to the client.
How does container will identify which servlet to be executed?
As soon as we deploy the application in the server then servlet container will load all servlet information in the memory. All servlet information will be places in Web application deployment configuration file.
What is deployment configuration file?
Deployment configuration file is simple xml file and it is heart of web applications.
Deployment configuration file having set of predefines tags which will provide the servlet information to container and other web application information.
Deployment configuration file have information like servlet URL mapping, servlet name and servlet implementation java class.
This deployment configuration we will specify as web.xml file. Any web application in java should have web.xml file.
Author
0 comments:
Post a Comment