0% found this document useful (0 votes)
20 views

Servlet Lect1

A web application is a program accessed through a web browser and stored remotely. It allows multiple users simultaneous access to the same application version. Components include the presentation layer for the user interface, business layer for logic, data access layer, and data service layer for security and storage. Servlets provide dynamic web pages through Java and are portable, scalable, and secure due to Java management.

Uploaded by

shubhtiwari882j
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Servlet Lect1

A web application is a program accessed through a web browser and stored remotely. It allows multiple users simultaneous access to the same application version. Components include the presentation layer for the user interface, business layer for logic, data access layer, and data service layer for security and storage. Servlets provide dynamic web pages through Java and are portable, scalable, and secure due to Java management.

Uploaded by

shubhtiwari882j
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

What is Web application?

A Web application (Web app) is an application program that is stored on a


remote server and delivered over the Internet through a browser interface.
Web services are Web apps by definition and many, although not all, websites
contain Web apps.

What is the purpose of different application?

An application, also referred to as an application program or application software,


is a computer software package that performs a specific function directly for an
end user or, in some cases, for another application. An application can be self-
contained or a group of programs.

Explain Web Application and advantage

A Web application (Web app) is an application program that is stored on a remote


server and delivered over the Internet through a browser interface.
Web applications do not need to be downloaded since they are accessed through a
network. Users can access a Web application through a web browser such as
Google Chrome, Mozilla Firefox or Safari.

Benefits

 Allowing multiple users access to the same version of an application.


 Web apps don’t need to be installed.
 Web apps can be accessed through various platforms such as a desktop,
laptop, or mobile.
 Can be accessed through multiple browsers.

What is Web Application Architecture?

Any application software that runs on a web server and its responses are provided
via a browser interface to the user. Unlike computer-based software programs, web
applications do not run on any operating system of the device. A web application
architecture defines the interaction between systems, applications, and databases
components together.

Whenever a user sends a request to open a web page, the server will send the file to
the browser. Afterward, it uses the files to showcase the page and the user can
interact with the page. The functionality of the web application is also similar to
website, but the difference lies in the code parsing.

Components of Web Application Architecture:

four commonest layers of web application architecture.

1. Presentation Layer:
The presentation layer aids in communication between the browser and the
user interface of the application that eases the overall user interaction. Every
presentation layer is created through JavaScript, HTML, CSS, and its
frameworks.
2. Business Layer:
The business layer helps in processing the browser requests, performs the
business logic of the requests, and shares the same back to the previous
layer. This layer primarily determines the business rules of the web app.
3. Data Access Layer:
The data access layer is used to access data from XML, binary files, and
other types of storage. In addition, it also helps in creating, reading,
updating, and deleting operations.
4. Data Service Layer:
The final one is the data service layer which ensures data security and stores
the entire data. This layer safeguards the data by separating the app business
logic from the client-side.

What is the role of HTTP Protocol

HTTP is the foundation of data communication for the World Wide Web. HTTP
functions as a request-response protocol in the client-server computing model.
In HTTP, a web browser, for example, acts as a client, while an application
running on a computer hosting a web site functions as a server.

As a request-response protocol, HTTP gives users a way to interact with web


resources such as HTML files by transmitting hypertext messages between
clients and servers. HTTP clients generally use Transmission Control Protocol
(TCP) connections to communicate with servers.

Methods to access web pages

The most commonly used HTTP request methods are GET, POST, PUT,
PATCH, and DELETE.

HTTP (Hypertext Transfer Protocol) specifies a collection of request methods to


specify what action is to be performed on a particular resource. The most
commonly used HTTP request methods are GET, POST, PUT, PATCH, and
DELETE. These are equivalent to the CRUD operations (create, read, update,
and delete).

GET: GET request is used to read/retrieve data from a web server. GET returns an
HTTP status code of 200 (OK) if the data is successfully retrieved from the server.

POST: POST request is used to send data (file, form data, etc.) to the server. On
successful creation, it returns an HTTP status code of 201.
PUT: A PUT request is used to modify the data on the server. It replaces the entire
content at a particular location with data that is passed in the body payload. If there
are no resources that match the request, it will generate one.

PATCH: PATCH is similar to PUT request, but the only difference is, it modifies
a part of the data. It will only replace the content that you want to update.

DELETE: A DELETE request is used to delete the data on the server at a


specified location.

The Common Gateway Interface (CGI) standard is a data-passing specification


used when a Web server must send or receive data from an application such
as a database. A CGI script passes the request from the Web server to a database,
gets the output and returns it to the Web client.
Servlet

Different types of component use in developing web application

All web-based database applications have three primary components: A web


browser (or client), a web application server, and a database server.

Advantages and disadvantages of servlet

Servlet technology is used to create a web application (resides at server side


and generates a dynamic web page). Servlet technology is robust and scalable
because of java language. Before Servlet, CGI (Common Gateway Interface)
scripting language was common as a server-side programming language.

What are the advantages of Servlet?


It provides better performance as it is capable to create the thread for each request
instead of the process.
Because the use of the Java language is easily portable.

It is robust in nature as JVM manages the servlet completely and thus we do not
need to worry about the memory leak, garbage collection and etc Java makes the
servlet more secure.

Servlet Advantage

 Servlets provide a way to generate dynamic documents that is both easier to


write and faster to run.
 Provide all the powerful features of JAVA, such as Exception handling and
garbage collection.
 Servlet enables easy portability across Web Servers.
 Servlet can communicate with different servlet and servers.
 Since all web applications are stateless protocol, servlet uses its own API to
maintain session

Servlet Disadvantage

 Designing in servlet is difficult and slows down the application.


 Writing complex business logic makes the application difficult to
understand.
 You need a Java Runtime Environment on the server to run servlets. CGI is
a completely language independent protocol, so you can write CGIs in
whatever languages you have available (including Java if you want to).

Services provided by web container


A web container handles requests to servlets, Jakarta Server Pages (JSP) files,
and other types of files that include server-side code. The Web container creates
servlet instances, loads and unloads servlets, creates and manages request and
response objects, and performs other servlet-management tasks.

Directory structure of web application

Directory Structure. Web applications use a standard directory structure


defined in the J2EE specification. You can deploy a Web application as a
collection of files that use this directory structure, known as exploded directory
format, or as an archived file called a WAR file.

Life cycle

How to package web application

Web modules are packaged as JAR files with a . war (web archive) extension.
Application client modules, which contain class files and, optionally, an
application client deployment descriptor. Application client modules are packaged
as JAR files.
Develop a web application using netbeans or eclipse.

You might also like