Ques.IN JAVA WHAT IS DIFFERENCE BETWEEN APPLET AND SERVELT?
Ans.1) Applet is client side application whereas Servlet is Server side application.
2) An applet is a Java program that runs within a Web browser on the client machine whereas a servlet runs on the Web server.
3) An applet can use the user interface classes like AWT or Swing while the servlet does not have a user interface.
4) Servlet is a server, Applet is a browser.
5) Applet is a downloadable small program which runs on the client side and executed by the client's java enabled browser or by the Apllet viewer. It doesn't need main() method to begin the execution,instead it begin's its lifecycle where the name of the class is passed to the Appletviewer.. The Applet's lifecycle have 4 methods.
init()-Where it can initialise itself
start()- It can start running
stop()-stop running
destroy()-Cleanup process happens
Applets are treated as untrused and they have a limited permission to run in the client browser
Servlet can be treated as Server-side applets.It runs in a servlet container which is deployed in the webserver. The lifecycle of the servlet have 3 methods.
init()
If an instance of the servlet does not exist, the Web container
a. Loads the servlet class
b. Creates the instance of the servlet class
c. Initialise the servlet instance by calling the init() method
service()-invokes this method by passing request and response object and a subsequent call to the same servlet is invoked as thread
destroy()-If the servlet container decides to remove the servlet, it calls this method
Ans.1) Applet is client side application whereas Servlet is Server side application.
2) An applet is a Java program that runs within a Web browser on the client machine whereas a servlet runs on the Web server.
3) An applet can use the user interface classes like AWT or Swing while the servlet does not have a user interface.
4) Servlet is a server, Applet is a browser.
5) Applet is a downloadable small program which runs on the client side and executed by the client's java enabled browser or by the Apllet viewer. It doesn't need main() method to begin the execution,instead it begin's its lifecycle where the name of the class is passed to the Appletviewer.. The Applet's lifecycle have 4 methods.
init()-Where it can initialise itself
start()- It can start running
stop()-stop running
destroy()-Cleanup process happens
Applets are treated as untrused and they have a limited permission to run in the client browser
Servlet can be treated as Server-side applets.It runs in a servlet container which is deployed in the webserver. The lifecycle of the servlet have 3 methods.
init()
If an instance of the servlet does not exist, the Web container
a. Loads the servlet class
b. Creates the instance of the servlet class
c. Initialise the servlet instance by calling the init() method
service()-invokes this method by passing request and response object and a subsequent call to the same servlet is invoked as thread
destroy()-If the servlet container decides to remove the servlet, it calls this method
198 comments:
Post a Comment