Servlet (Server Applet) is the abbreviation of Java Servlet, which is called a small service program or service connector. It is a server-side program written in Java and has the characteristics of being independent of platform and protocol. The main function is to browse and generate data interactively and generate dynamic Web content.
In the narrow sense, Servlet refers to an interface implemented by the Java language. In the broad sense, Servlet refers to any class that implements this Servlet interface. Generally, people understand Servlet as the latter. Servlets run in Java-enabled application servers. In principle, Servlets can respond to any type of request, but in most cases Servlets are only used to extend Web servers based on the HTTP protocol.
The first to support the Servlet standard was JavaSoft's Java Web Server. Since then, some other Java-based Web servers have begun to support standard Servlets.
Servlet is a small program running on the server. The term was coined in the context of a Java applet, a small program that is sent as a separate file with a web page. It is usually run on the client and the results are computed for the user or positioned based on user interaction. Graphics and other services.
Some programs are required on the server, often programs that access the database based on user input. These are typically accomplished using Common Gateway Interface (CGI) applications. However, running Java on the server, such a program can be implemented using the Java programming language. On high-traffic servers, the advantage of JavaServlets is that they execute faster than CGI programs. Each user request is activated as a thread in a single program without the need to create a separate process, which means that the system overhead of processing requests on the server side will be significantly reduced.
Related learning recommendations: java basic tutorial
The above is the detailed content of What is Java Servlet?. For more information, please follow other related articles on the PHP Chinese website!