Servlet
INTRODUCTION:
Over
the last few years, Java has become the predominant language for server-side
programming.
This is due in no small part to the Java
Servlet API, which provides
a
standard way to extend web servers to support dynamic content generation.
With
the introduction of the J2EE specification for enterprise applications,
servlets
have
taken over as the primary interface for thin-client applications. In terms of
enterprise
computing, servlets are a natural fit if you are using the Web as your
deployment
platform. You can take advantage of web browsers as universally
available
thin clients using the web server as middleware for running application
logic.
Under this model, the user makes a request of the web server, the server
invokes
a servlet designed to handle the request, the servlet fulfills the request,
and
the result is returned to the user for display in the web browser.
While
this sounds like every other dynamic content technology (such CGI, ISAPI,
ASP,
PHP, and the like), servlets have some major advantages. For one, servlets
are
persistent between invocations, which dramatically improves performance
relative
to
CGI-style programs. Servlets are also 100% portable across operating
systems
and servers, unlike any of the alternatives. Finally, servlets have access to
all
the APIs of the Java platform, so, for example, it is easy to create a servlet
that
interacts
with a database, using the JDBC API.
What
are we going to learn in this tutorial??
1
Servlets
9
Database Connectivity in servlet
A
Servlet is a Java-based server-side web technology. As the name implies, it
serves a client request and receives a response from the server. Technically
speaking, a Servlet is a Java class in Java EE that conforms to the Java
Servlet API, a protocol by which a Java class may respond to requests. They are
not tied to a specific client–server protocol, but are most often used with the
HTTP protocol. Therefore, the word "Servlet" is often used in the
meaning of "HTTP Servlet". Thus, a software developer may use a
servlet to add dynamic content to a web server using the Java platform. The
generated content is commonly HTML, but may be other data such as XML. Servlets
are the Java counterpart to non-Java dynamic Web content technologies such as
PHP and ASP.NET. Servlets can maintain state in session variables across many
server transactions by using HTTP cookies, or URL rewriting.
To
deploy and run a Servlet, a web container must be used. A web container (also
known as a Servlet container) is essentially the component of a web server that
interacts with the Servlets. The web container is responsible for managing the
lifecycle of Servlets, mapping a URL to a particular Servlet and ensuring that
the URL requester has the correct access rights.
The
Servlet API, contained in the Java package hierarchy javax.servlet, defines the
expected interactions of the web container and a servlet.
Comments
Post a Comment