On the Java Web Servlet

1.Servlet Overview

The origin (1) Serlet name?

Servlet is short for Java Servlet, Servlet itself is not an English word, but two words spell structure made of: Servlet = Service + Applet. Similarly the Scriptlet, it is also spell configuration formed by two words: Scriptlet = Script + Applet, it represents the scriptlets. It can be seen, the characteristics of java naming of former club sun.

What (2) Servlet that? Used to do?

Servlet is actually a small program that is using java language, this small program running on the server side. For Servelet our understanding can be divided into two levels:
(1) refers to a narrow Servlet interface to Java language.
(2) Servlet refers to any broad class implements Servlet interface, under normal circumstances, it will be appreciated that the latter Servlet.
We know that Java Web resources into a dynamic resource and static resources, which features dynamic resource is logical, but the logic of dynamic resource is presented by the java code, the specific implementation is to run java code on the server side, but also It is our Servlet. But Servlet and we usually write java code also has differences:
(1) because it runs on the server side of Web server software, so it has to follow certain rules. It is a concrete manifestation of the rule to follow is to write run on the server side of the applet, the need to implement the Servlet interface. After the realization of this program interface written, called Servlet program.
(2) We usually write the program is that we take the initiative to call it, that is, use it in the main method. However, running a small program on the server side, that is, we do not need Servlet take the initiative to call it, when you need to perform, our server software will be to call it.
(3) actually said we will not take the initiative to call it, is not entirely correct. As a customer, when we use the web browser to access some of the resources, in fact, it might launch a call to the Servlet. However, this request through the middle of the web server software this layer, which is our first request to the web server software, web server software to go to a specific implementation of a servlet. That web server software which Servlet know how we want to enforce it? It is reflected in how it? The answer is through url reflected. That is when we enter a path in the browser, probably in a request to execute the Servlet. Therefore, we need to configure every Servlet a url.

(3) Servlet features

Servlet itself does not depend on the agreement or platform. Its main function is to interactively browse and generate data, generate dynamic Web content. In layman's terms, it is used to generate web applications and resources, such as html page.

2.Servlet inheritance system

3.Servlet common implementation class

Guess you like

Origin www.cnblogs.com/lasnitch/p/11457045.html