Servlet Lect1
Servlet Lect1
Benefits
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.
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.
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.
The most commonly used HTTP request methods are GET, POST, PUT,
PATCH, 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.
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
Servlet Disadvantage
Life cycle
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.