Java Servlet

From HaFrWiki
Revision as of 16:56, 28 August 2015 by Hjmf (talk | contribs) (Created page with "{{TOCright}} Java Servlets are the main entries for developing Java Web applications. But what is a servlet exactly. A short introduction created on several sources on the Int...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Java Servlets are the main entries for developing Java Web applications. But what is a servlet exactly. A short introduction created on several sources on the Internet [1].

Introduction

What is a Java servlet? Essentially, a servlet is a Java applet that's designed to run on a server, rather than on a web browser. [2] They're commonly use to extend the capabilities of a server.

For instance, a servlet might act as an interface to run a database query. It might hold and manage additional information alongside a stateless HTTP protocol. Or it might convert input from an HTML form into a format more useful to the server. In their function, servlets can be thought of as the Java counterparts to other technologies like PHP and ASP.NET.

Request-Response

The main model for a servlet is request-response. Applications or users interact with the servlet by sending a request, perhaps for a certain piece of data. The servlet then takes that request and translates it into a series of operations on the server itself. The results from the server are translated back into a response that the user can readily understand. In this sense then, a servlet is just a translator between the user interface and the server behind it. Technically speaking, an application is only a servlet if it implements the Java Servlet API, which defines the overall structure for the servlet family of classes.

The main model for a servlet is request-response. Applications or users interact with the servlet by sending a request, perhaps for a certain piece of data. The servlet then takes that request and translates it into a series of operations on the server itself. The results from the server are translated back into a response that the user can readily understand. In this sense then, a servlet is just a translator between the user interface and the server behind it. Technically speaking, an application is only a servlet if it implements the Java Servlet API, which defines the overall structure for the servlet family of classes.


See also

top

Reference

top

  1. Lynda.com, What is a servlet.
  2. Look at the names Servlet and Applet, which references to the Server and the Application (Client).