Back to: Java Servlets Tutorials
Introduction to Web Application and Web Terminology
In this article, I am going to give you a brief introduction to Web Application and Web Terminology used in Web Application. As part of this article, we are going to discuss the following pointers in detail.
- What is a Website?
- What is the architecture of a Static and Dynamic Website?
- What is a Java-Based Dynamic Website?
- What is Web Client?
- What is a Web Server?
- How to overcome the Limitations of Web Server?
- What are the General Duties of a Server-side Program in the context of a website?
- What type of application can be developed using Java?
- Understanding Tier Architecture
- Understanding Server-Side Programming
- Why Server-Side Programming?
- Advantages of Server-Side Programs
- Understanding Client-Server Architecture
What is a Website?
A collection of web pages mostly belong to a single organization is nothing but a website. Web sites are of two types
- Static websites
- Dynamic websites
What is the architecture of a Static Website?
A non-interactive website is known as a static website. A static website cannot take user input and cannot provide user-specific information.
In the case of a static website, no server-side programming is required and no database is involved. Only generic information is provided by the website and that also common for all users is called a static website.
What is the architecture of a Dynamic Website?
An interactive website is known as a Dynamic website. A Dynamic website can take user input and can provide user-specific information. In the case of a commercial dynamic website, server-side programming and database are mandatory.
What is a Java-Based Dynamic Website?
If a website is made interactive by using the following, it is known as a java-based dynamic website.
- Java language for web server-side programming
- Servlets and JSP as web technologies
- JDBC as the data access technology
Note: Dynamic website is also known as the web application.
What is Web Client?
A Software that requests the webserver for web pages (resources) is nothing but a web client. A web client uses Hypertext Transfer Protocol (HTTP) to communicate with the webserver and hence called an HTTP client.
In fact, the browser is the web client.
What is a Web Server?
The server software that provides web pages (resources) to the web client is nothing but a web server. The web server uses HTTP to communicate with web clients. Therefore, it is also known as the HTTP server (service). The web server has two major duties
- Providing connections to web clients.
- Providing requested web resources (mostly web pages) to web clients.
The Static or Dynamic website is hosted on the webserver. The web server has the following limitations.
- It can’t communicate with the database.
- It can’t process the data.
- It can’t produce the user required response page.
If a web server alone is used for the website, it becomes only a static website i.e. a web server on its own can support only static websites.
How to overcome the Limitations of Web Server?
Through server-side programming. In the context of a website, server-side programming is meant for making that website interactive (Dynamic).
What are the General Duties of a Server-side Program in the context of a website?
To make the website dynamic (interactive), server-side programs perform the following duties.
- Capturing user input.
- Communicating with the database.
- Processing of data.
- Producing the response page.
- Handing over the response page to the webserver.
What type of application can be developed using Java?
In general, by using Java technology we are able to design the following two types of applications:
These are the Java applications, which can be designed without using Client-Server Architecture. Standalone applications mean which reside inside the client system and runs in the same client system but standalone applications are having several disadvantages like standalone applications that must be installed in all the client systems. If standalone applications need to be updated then we need to update in all the client systems so we will get maintenance issues. Standalone applications require the maximum amount of resources from the client system like memory, CPU, hard disk space, etc. To maintain standalone applications, the client should have minimum knowledge like how to configure, how to install, etc. Generally, every standalone application contains the main() method. Example: AWT, Swings, etc.
There are two types of Standalone Applications:
- CUI Applications
- GUI Applications
CUI Applications ae the standalone applications, which will be designed in such a way to take input and to provide output by using the command line prompt, where the Command prompt is acting as an interface and is ready to support character data. So that the java application which can design on the idea of prompt i.e. character user interface is called CUI Applications.
GUI Applications are the standalone applications, which can be designed in such how to require input and to supply output by employing a collection of Graphic component, where the collection of Graphic components is acting as an interface and is ready to support the GUI component in order that the java application which can be designed on the idea of Graphical User Interface is called as GUL Application.
These are the Java applications, which can be designed on the idea of Client-Server Architecture. There are two types of Enterprise Applications:
- Web Applications
- Distributed Applications
Web applications are a collection of web components, it will be executed by using web containers like Servlet Container to execute servlets, JSP, Container to execute JSP’s, and so on. Web Application is the server-side application, it will be designed without distributing its application logic over a number of JVM. In general, web applications will be designed by using a set of server-side technologies called Web Technologies like CGI, Servlets, JSP’s, and so on. The main purpose of web applications is to get a dynamic response from the server machine. In general web applications will provide services for web clients. Web Applications are going to be executed by using both web servers and application servers.
Distributed applications are a collection of distributed components, it will be executed by using distributed containers like EJB’s Container to execute EJB’s. The Distributed application is the server-side application it will be designed by distributing application logic over multiple numbers of JVM. Distributed applications will be designed by using a set of technologies called Distributed technologies like Socket Programming, RMZ, EJB’s, Web Services, and so on. The main purpose of distributed applications is to determine distributed communication between the local machine and remote machine so as to access the remote services. Distributed applications will provide for any type of client. Distributed applications are going to be executed by using only application servers.
Enterprise Application Design
Enterprise is a business organization, a group of organizations running under a single label. In a software application, which will be designed for a particular enterprise in order to simplify internal business processing. To design enterprise applications, we have to use the following three layers.
- User Interface Layer/ Presentation Layer
- Business processing layer
- Data storage and access layer
User Interface Layer
User Interface Layer is the topmost layer in enterprise application, it will provide a starting point for the customers to interact with enterprise applications. The main purpose of the User Interface Layer in enterprise applications is:
- To improve the look and feel for enterprise applications.
- To accept user details in order to execute the server-side applications.
- To specify different types of requests at client browser like get, post, head, and so on.
To prepare the User Interface Layer in enterprise application we will use a separate logic is called Presentation Layer. To prepare presentation logic in enterprise applications we have to use technologies like AWT, SWING, HTML, JSP, Velocity, and so on.
Business Processing Layer
The business Processing Layer is the heart of the enterprise application, it will provide a very good environment to define and execute all the business rules and regulations which are required by the client. To prepare Business Processing Layer in enterprise application we will use a separate logic is called Business Logic.
In enterprise application development, to prepare Business Logic we have to use technologies like Servlets, JSP’s, Java Beans, EJB, and so on.
Data Storage and Access Layer
This layer is the bottom-most layer in enterprise applications. The main purpose of this layer is to provide data persistently in enterprise applications. Data storage and Access Layer will provide a very good environment to provide the basic database operations (CRUD) as per the enterprise application requirement.
To prepare Data Storage and Access Layer we will use a separate logic called Persistence Logic. In enterprise application development, to prepare persistence logic we have to use technologies like JDBC, EJB- Entity Beans, Hibernate, JPA, and so on.
Understanding Tier Architecture
To design enterprise applications, we need to define the degree of enterprise application, for this, we have to use system architectures.
- 1-Tier Architecture
- 2-Tier Architecture
- n-Tier Architecture
To design enterprise application if we use tire-1 architecture then we have to provide the User Interface Layer, Business Processing Layer, and Data Storage and Access Layer within a single machine. The 1-Tier architecture is highly recommended for standalone applications.
In 1-Tier architecture, a single machine we have to use to accommodate the complete application so that a single machine resource may not be sufficient to execute applications, it may reduce the performance of enterprise application. The 1-Tier architecture will not provide any environment to handle multiple number requests, it is able to provide less shareability.
To design any enterprise application, it is minimum to use 2-Tier architecture. The best example of 2-Tier architecture is Client-Server architecture. The 2-Tier architecture will allow us to design and execute the application in 2 layers of machines.
In the case of 2-Tier architecture, tier-1 will manage the User Interface Layer and tier-2 will manage Business Processing Layer and Data Storage and Access Layers. The 2-Tier architecture will provide a loosely coupled design when compared with 1-Tier architecture. The 2-Tier architecture will provide a very good environment to handle the multiple numbers of requests and it is able to improve shareability.
Note: As part of the enterprise application development always it is suggestible to use Tiered architectures because it will improve shareability, able to provide more loosely coupled design, and so on, but we should not increase the number of tiers in enterprise applications without having the requirement otherwise maintenance problems will be increased.
At the start stages of the pc, we’ve client-Server architecture, where the aim of the server is to carry up some resources and to share that resources to all or any the clients as per the client request. In the above context, once we send an invitation from the client to the server for a specific resource then the server will identify the requested resource, devour the content and send that content as a response to a client without performing any particular action at the server. In this case, the response which was generated by the server is named as a static response.
As per the appliance requirements, we’d like to get a dynamic response from the server for this we’d like to execute the appliance at the server called as Web Application. To design web applications at the server-side we’d like a group of server-side technologies called as Web Technologies.
To design web applications, we will use web technologies like CGI, Servlets, JSP, Perl, PHP, and so on. Therefore, the main purpose of servlets and JSP’s is to design web applications at the server in order to generate a dynamic response from the server.
Any computer running Servlet or JSP needs to have a container. A container is nothing but a bit of software liable for loading, executing, and unloading the Servlets and JSP. While servlets are often wont to extend the functionality of any Java-enabled server. They are mostly used to extend web servers and are efficient replacement of CGI scripts. CGI was one of the earliest and most prominent server-side dynamic content solutions.
What is a Web Server?
A web server is the combination of computers and therefore the program installed thereon. The web server interacts with the client through an internet browser. It delivers the online pages to the client and to an application by using the online browser and therefore the HTTP protocols respectively. We can also define the online server because of the package of a huge number of programs installed on a computer connected to the Internet or Intranet for downloading the requested files using File Transfer Protocol, serving e-mail and building and publishing sites. A web server works as an o client-server model. A computer connected to the web or Intranet must have a server program. While talking about Java language then an internet server may be a server that supports the online component just like the Servlet and JSP. Note that the online server doesn’t support EJB (business logic component) component.
All of us would have started programming in Java with the ever famous “Hello World!” program. If you can recollect, we saved this file with a .java extension and later compiled the program using java and then executed the class file with java. The point to be noted is that – “It is a client-side program”. It means that you write, compile, and also execute the program on a client machine. No doubt, this is often the simplest and fastest way to write, compile, and execute programs.
Why Server-Side Programming?
It is technically feasible to implement almost any business logic using client-side programs, logically or functionally it carries no ground when it involves enterprise applications. There are issues like security, resource pooling, concurrent access, and manipulations to the database which simply cannot be handled by client-side programs. The answer to the issues is – “Server-Side Programming”.
Advantages of Server-Side Programs
- All programs reside in a single machine called the Server. Any number of remote machines (called clients) can access the server programs.
- New functionalities to existing programs can be added to the server-side which the clients’ an advantage without having to change anything from their side.
- Migrating to newer versions, architectures, design patterns, adding patches, switching to new databases are often done at the server side without having to bother about clients’ hardware or software capabilities.
- Issues concerning enterprise applications like resource management, concurrency, session management, security, and performance are managed by service side applications.
- They’re portable and possess the potential to get dynamic and user-based content.
From the above representation, there are three major components in a client-server architecture.
The main purpose of the Client in client-server architecture is to send a request to the server and to set the responses from the server. To send a request and to set response from the server we need to use a tool at the client machine called Browser. In the client-server application, the browser is acting as the client. To access a particular resource available at the server from the client browser we need to specify a particular string at the browser address bar called URI.
URI is a string specification provided at the client address bar, it can be used to refer a particular resource available at the server machine. There are two types of URI’s:
URL: URL is a string specification provided at the client address bar, it can be used to refer a particular resource available at the server machine through its locator.
URN: URN is a string specification; it can be used to refer a particular resource available at the server machine through its logical name.
Note: In the case of servlets, the locator is an URL pattern defined in the web.xml file. In the case of servlets, the logical name is a name specified along with <servlet-name> tag in the web.xml file. Almost all the servers are able to accept the URL kind of request, but almost all the servers do not accept the URN kind of request.
If we want to provide a URL, at the client address bar then we have to use the following syntax:
Here Query_String, i.e. uname=abc&upwd=abc is optional.
The main job of the protocol in client-server architecture is to carry the request data from client to server and to carry the response data from server to client. The Protocol is a set of rules and regulations, which can be used to carry the data from one machine to another machine over the network. Example: TCP/IP, FTP, HTTP, SMTP, ARP, RARP, etc,
In general, in web applications, we will use the HTTP protocol to send requests from the client to the server and to set response from the server to the client.
Upon receiving the request from the protocol server will identify the requested resource, execute generate the dynamic response, and dispatch that dynamic response to the client. When the server dispatch the dynamic response to the client protocol will pick up the response and perform the following actions:
- The protocol will prepare response format with the header part and body part, where the header part will manage response headers (metadata about the dynamic response) and the body part will manage the actual dynamic response.
- After seeing the response format protocol will carry the response format to the client.
- When the dynamic response reached to client protocol will terminate the virtual socket communication, this protocol will eliminate the present request data from its memory.
In the above context, the present request data will be managed by the protocol up to the connection’s existence will protocol connection has terminated then the protocol will not manage request data.
The main purpose of the server in client-server applications is to pick up the request from the client, identify the requested resource, generate the dynamic response, and dispatch dynamic response to the client.
Note: Servlet is a program available at the server machine, it is not capable to pick up the request and dispatch response to the client, if the server executes the servlet program then some dynamic response will be generated.
Example: Apache Tomcat, BEW Weblogic, IBM Websphere, Macromedia JRun, SUN Sunone, J@EE, GlassFish, and so on.
There are two types of server to execute Enterprise Applications:
- Web Servers
- Application Servers
Web Server: A Web Server is a server, which will provide a very good environment to execute web applications only. In general, web servers will not provide all middleware services.
Application Servers: Application Servers will provide a very good environment to execute any type of J2EE application like web applications, distributed applications, and so on. The application server will provide all the middleware services like JND, JDBC, and so on in-built support.
Application server = Web Server + Middleware Services
If we want to specify a particular machine has server machine then we have to install particular server software, when we install the server software on the server machine automatically that server software will be available in the form of the following two modules:
- Main Server
When we send a request from the client to the server then the main server will pick up the request from the protocol and check whether the requested data is in a well-formed format or not if it is not in the well-formed format then the main server will stop request their itself and generate the respective response to the client.
If the requested data is in the well-formed format then that request will bypass the container, where the container will identify the requested resource, execute it, generate a dynamic response, and dispatch a dynamic response to the main server, where the main server will bypass response to the client through the protocol.
Types of Container
As per the technology which we used to design the server-side component. There are some containers:
- Servlet Container – To execute Servlets
- JSP Container – To execute JSP’s
- EJB Container – To execute EJB’s
Note: All the above-specified containers can be used to execute the respective components because the above containers have implemented the respective technology API.
As per the containers physical existence, there are three types of containers:
- Standalone Container – It is an integration of the main server and container as a single program.
- Inprocess Container – It is a container that existed inside the main server.]
- Out of Process container – It is a container that existed inside the main server.
In the next article, I am going to Give a Brief Introduction to Java Servlets. Here, in this article, I try to give a brief introduction to Web Application and Web Terminology. I hope this article will help you to understand Web Application and Web Terminology.