The related salutation of the web system:
1. Web server
The Web server primarily handles static page processing and acts as a servlet container to interpret and execute servlet/jsp, such as Tomcat, Appach, Ngnix, and so on.
2. Application Server (Application server)
Web application: A Web application is a Web page that accesses a Web server through an HTTP request, or a program that performs a service-side web page technology, for example: asp,asp.net,jsp,php.
Application servers (application servers) run business logic, primarily the Java EE API, such as EJB, Jndi, and Jmx APIs, as well as transactional processing, database connectivity, and so on, so application servers provide more power than Web servers in enterprise applications. For example: Weblogic, WebSphere, and JBoss belong to the application server.
3. Middleware
Middleware is between the operating system and the higher-level application. His function is to isolate the application runtime environment from the operating system so that application developers do not have to worry about more system issues, but directly focus on the application's ability to solve problems. For example, the database connection, mail service, transaction processing and so on are some common enterprise requirements module, these modules if each redevelopment is done by the developer, will lead to long development cycle and poor code reliability problems. So many large companies have developed their own generic module services. These service software families are collectively referred to as middleware. In order to assemble the different middleware developed by each company, the concept of standard is put forward. In fact, it is a series of standards based on Java technology.
For example: Personal or general projects with tomcat;linux under the jetty or Apache HPPTD; a large project with JBoss or WEBLOIGC or Webshere,jboss is a Java EE application server running EJBS.
4. Web container (container is a kind of middleware)
Web Container : Provides an environment, JSP container, and SERVLET container for the application component (Jsp,servlet) in which it is located. Enables Jsp,servlet to interact directly with the environment variable interfaces in the container without having to focus on other system issues. Implemented primarily by Web servers. For example: Tomcat,weblogic,websphere and so on. The interface provided by this container strictly complies with the Web application standard in the Java EE specification. Our web server, which adheres to the above criteria, is called the Web container in Java EE.
EJB Container : Enterprise java bean container. It has the industry domain characteristic more. He provides various management functions for the EJB component that runs in it. As long as the EJB that satisfies the Java EE specification is placed in the container, it is immediately managed efficiently by the container. and the system-level services can be obtained through the existing interfaces. For example, mail service, transaction management.
5. servlet
Why Servlets are needed:
When requesting a resource from a Web server, the Web server specializes in providing static pages (two things that a Web server cannot do: A dynamic instant page cannot be provided, no data is saved to the database), and if a dynamic content is required, You need another helper help on the Web server (the Web server calls this helper program for dynamic content presentation). And the servlet plays the role of the helper application. That's why the servlet is needed. Accessing a static page does not have to configure the servlet, and if the JSP Dynamic Web page is to be a servlet.
How the servlet Works : An HTTP request arrives, the container encapsulates the request into a requestor object in the servlet, you can get all the information in the request, and then you can take it out and manipulate it. Finally, the data is encapsulated into a servlet's response object, and the application container encapsulates the response object into an HTTP response after parsing.
The browser sends an HTTP request, the HTTP request is assigned by the Web container to the specific servlet for processing, and the servlet is essentially a Java object that has a series of methods to handle HTTP requests. Common methods are doget (), DoPost () and so on. The Web container contains more than one servlet, which is determined by which servlet the specific HTTP request is handled by the Web container.
Servlets can only be used in Java, other languages cannot be programmed with servlets (unless there is a way to do it with Java compatibility)
The related salutation of the web system