What is Servlets?
Servlets is a Java technology that focuses on CGI development. Run on the Server and generate dynamic results. Why should we use Servlets instead of traditional CGI programs?
Efficiency: When a traditional CGI program receives an HTTP request, the system starts a new process to process the request, which will reduce the system performance. With Servlets, Java VMs has been running. After receiving a request, Java VMs creates a Java thread to process it immediately, this is much more efficient than starting a new system process every time.
Powerful functions: Servlets allows you to use many powerful functions that traditional CGI cannot provide. You can use Java APIs to accomplish anything that traditional CGI deems difficult or impossible. Servlets can easily implement data sharing and information maintenance, and track sessions and other functions.
Security: Servlets runs within the limits of the Servlets engine, just like running Applets in a Web browser. This helps protect Servlets from threats.
Cost: Because Servlets can run on multiple Web servers, you can use a free or inexpensive server and enable it to support Servlets, which can greatly reduce costs.
Flexibility: Because Servlets runs on the Java platform, because of Java's cross-platform nature, Servlets can easily be transferred from one platform to another, greatly improving flexibility.
A Servlets is actually a Java class. It needs to run on a Java Virtual Machine and use the Servlets engine. When a Servlets is requested, the Servlets engine calls this Servlets and runs until the called Servlets is completed or the Servlets engine is disabled.
JavaServlets development tool JSDK) can be downloaded from Sun's website. It includes Servlets APIs and a simple Servlets engine.
- Servlet Container session tracking
- Detailed description of Servlet instances
- Introduction to Servlet read request headers
- Call the Http Servlet Request Method
- Basic Structure of Servlet