Home >Java >javaTutorial >Why use tomcat?
First of all, tomcat is open source, developed based on the java language, and is a container for deploying web projects. Ordinary HTML can be processed directly by the browser without the need for deployment such as tomcat. However, such as servlets, the browser cannot directly parse the content inside. These require a tool to process the data so that the browser can correctly identify this information when accessing the host.
can help us connect http requests (do some general processing), and then forward the requests to our servlet processor for processing. We only need to put our business processing in the service method of the servlet, no There are other redundant things to focus on.
Specific processing method:
1. First use http to access your web application. Your server needs to open a port to listen for requests, right?
2. Since the http protocol is used, do you need to parse the http request from the network?
3. After parsing, do you need to access the corresponding application system?
4. Do you need to return the result set returned by the system after processing the request to the user so that the user can display it in the browser?
Middleware just helps you complete these things: open the listening port to listen to the user's request, parse the http request sent by the user and then access the application system you specify, and then return the page you return to through tomcat. user.
The above is the detailed content of Why use tomcat?. For more information, please follow other related articles on the PHP Chinese website!