There are some things to note to note about Servlets as opposed to Applets.
Firstly, the servlet and its environment is completely under the control of those deploying it. That is, you have control of which JVM is used and that this is independent of the browser used by the user. This is important as it removes concerns associated with the so-called “browser” wars.
Secondly, a servlet is not constrained by the applet sandbox. This means that a servlet can reside behind a firewall and can communicate with any and all systems that it needs to. For example, JavaIDL can be used to connected to a CORBA compliant Object Request Broker (ORB) or sockets to connect to legacy systems (for example implemented in C).
Thirdly, the client Web browser does not communicate directly with the servlet. Rather the browser communicates with the Web server, which in turn communicates with the servlet. Thus if the web server is secure behind a firewall, then the servlet is also secure.
Fourthly a single Servlet can process multiple user requests. That is one instance (by default) of a Servlet is loaded into the web server and this instance services all user requests. This does not mean that each request is queued. Rather it means that each request is handled by a separate thread (of execution) that uses the same servlet instance.
Fifthly, as each Servlet is shared amongst multiple users, care must be taken with user specific data. For example, this means that sensitive user information should not be stored in an instance variable as the instance is shared amongst many users. This can be overcome by using a HttpSession object that can be obtained from the initial request. Each session object is linked to a single user.
2006-11-20 18:36:00
·
answer #1
·
answered by srihari_reddy_s 6
·
0⤊
0⤋
Applet - a Java program designed to be embedded in an HTML document (a "plug-in" content type) similar to a flash app or an image. The browser downloads the applet and runs it in the Java Plug-in. It is a "client-side" Java application since it is delivered to the client end in a web environment.
Servlet - a type of Java program executed at the web server. HTTP requests (as in browser web requests) are directed to the servlet, it executes and produces the result that is sent back. The return data can be another web page that is dynamically constructed with updated data, any other document type, or even serialized Java objects! Servlets are "server-side" Java applications.
2006-11-16 14:57:07
·
answer #2
·
answered by vincentgl 5
·
0⤊
0⤋