Servlet is a Java program that runs on the Web application server using the Java Servlet interface. It is different from a common Java program. It can process Web browsers or other HTTP requests. It is a Java application on the server inside the web service.
The initial JSP development mode is JSP + JavaBean called model1. JSP + servlet + JavaBean is gradually changed to the model2 mode. Generally, the model1 mode is used when a small or medium-sized website is created, and the model2 mode is used when a large website is created.
Servlet is a server-side Java application independent of platform and protocol. It can generate dynamic web pages.
Servlet is a Java program that uses Java Servlet applications to design interfaces and related classes and methods. Servlet is mainly used to process HTTP requests sent from the client and return a response. Generally, the servlet is httpservlet, which is used to process HTTP requests. The processed requests include doget (), dopsost (), and service (). During servlet development, it can directly inherit javax. servlet. HTTP. httpservlet.
Servlet needs to be described in Web. XML, for example, the name of the servlet to be mapped, the servlet class to be configured, the initialization parameters, the security configuration, URL ing, and setting the startup priority. Servlet can not only generate HTML Script output, but also generate binary forms for output.
Servlet creates a framework to expand the server's capabilities for Web requests and responses. When a client sends a request to the server, the server can send the request information to the servlet, and let the servlet establish the response from the server to the client. When the Web server or client requests the service for the first time, the servlet can be automatically loaded and the servlet continues to run until other clients send requests.
Servlet functions include the following:
1. Create and return a complete HTML page containing dynamic content based on the nature of the customer request.
2. Create an hlml page (HTML segment) that can be embedded into an existing HTML page)
3. Communicate with other server resources (including database resources and Java-based applications.
4. Use multiple clients to process links, receive input from multiple clients, and pass the results to multiple clients. For example, servlet can be a game server with multiple participants.
5. Provide the specified processing to standard programs on all servers. For example, servlet can modify how to authenticate users.
Servlet series (1) ---- servlet Introduction