Applets vs Servlets
A program written in Java that can be embedded in a HTML page is called an applet. A Java enabled browser can be used to view the web page containing the applet. When the page containing an applet is viewed, the code of the applet is transferred to the user computer and executed on the Java Virtual Machine (JVM) of the browser. A Java program that is used to improve/ extend the functionalities of a server is called a servlet. The server should be accessed by the host applications using the request-response model. In simple terms, a servelt can be seen as an Java applet running on the server.
What is an Applet?
A program written in Java that can be embedded in a HTML page is called an applet. A Java enabled browser can be used to view the web page containing the applet. When the page containing an applet is viewed, the code of the applet is transferred to the user computer and executed on the Java Virtual Machine (JVM) of the browser. Applets allow providing the user with interactive features that might not be possible to provide using only HTML. Since the applet’s code is run on JVM, applets are platform independent (supports Microsoft Windows, UNIX, Mac OS, etc.) and can run in any browser that supports Java. Furthermore, applets are cached by most web browsers. Hence applets could be loaded quickly when returning to a web page. When it comes to security, there are two types of applets called signed applets and unsigned applets. Unsigned applets have some important restrictions like inability to access the local file system. They can only access the applet download site on the web. Signed applets can behave as a standalone application once its signature is verified.
What is a Servlet?
A Java program that is used to improve/ extend the functionalities of a server is called a servlet. The server should be accessed by the host applications using the request-response model. In simple terms, a servelt can be seen as an Java applet running on the server. Typically servlets are used for storing/ processing data that were submitted using an HTML form and to provide dynamic content in a web page. Furthermore, servlets are used for managing state information. Java servlets are efficient, easier to use and portable compared to other CGI (Common Gateway Interface) technologies.
What is the difference between Applets and Servlets?
A java program that can be embedded in a HTML page and viewed using a Java enabled browser is called an applet, while a Java program that is used to improve/ extend the functionalities of a server is called a servlet. Actually, a servlet can be seen as an applet running on the server. An applet is downloaded in to the client’s machine and run on the client’s browser, whereas a servlet runs on the server and transfers the results back to the client when it is done. When using applets, the entire code of the applet has to be transferred to the client. Therefore it consumes more network bandwidth than servlets, which transfers only the results to the client.
Source: differencebetween.com
0 comments:
Post a Comment