简体   繁体   中英

Servlet = Server Applet?

I am used Java Language for several years. but I thought, 'I missed the origin concept past years.'

Now, I have a question.

I know Java Applet is small process or program, so is Application. Then, What is Servlet? Is it a Server-side Applet?

Then, server-side small process and equals as thread?

Yes, the term “applet” means an application hosted within some kind of environment that does most of the work of dealing with the operating system and hardware. The idea is that writing an applet is relatively simple, and you as a programmer can focus mostly on the functionality of your application, and not spend much time or effort getting it to run and interact with the outer host. The mundane aspects of lifecycle (launching and quitting), managing menus, windowing, and such are handled by the applet container, to relieve the applet programmer of that burden. The term “applet” predates Java, by the way.

Yes, the term “Servlet” has the same intention as “applet”, but server-side rather than desktop client-side. The term may have been coined for Java (not sure), and instantly communicated the idea of Java Servlet technology: To provide a runtime environment that does most of the work for handling web requests and responses so that the programmer can focus on the key functionality. The mundane aspects needed by all such applications such as handling the incoming requests, parsing headers, interacting with the web browser, managing network connections, and threading, can be handled by the Servlet container rather than every app programmer repeating that implementation for themselves.

Yes, every invocation of a Java Servlet (each incoming request) is handled on a Java thread. Managing the creation, destruction, and pooling of those threads is part of the services provided by a Java Servlet container such as Apache Tomcat, Eclipse Jetty, etc.

For more info, read Wikipedia , and read the Servlet specification .

Servlets are the Java programs that runs on the Java-enabled web server or application server. They are used to handle the request obtained from the web server, process the request, produce the response, then send response back to the web server.

Servlets run on a Servlet container on the server. Almost all JEE application servers (Tomcat, WebLogic, Spring, etc.) include a Servlet container. Unlike an Applet, the Servlet can scale across multiple server instances and provides richer integration with back-end systems like Databases and Messaging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM