Java Servlets Question and Answers

25. What is ServletContext?
  ServletContext is an interface that defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests or writes to a log file. There is one context per "web application" per Java Virtual Machine.
 
Your Name Your Email-ID
Your Answer
26. What is a servlet?
 
  • Java servlet are server side components that provides a powerful mechanism for developing server side of web application.
  • Earlier CGI was developed to provide server side capabilities to the web applications.
  • Although CGI played a major role in the explosion of the Internet, its performance, scalability and reusability issues make it less than optimal solutions.
  • Java Servlets changes all that. Built from ground up using Sun's write once run anywhere technology java servlets provide excellent framework for server side processing.
 
Your Name Your Email-ID
Your Answer
27. Differentiate between Servlet and Applet?
  Servlet are server side components that execute on the server whereas applets are client side components and execute on the web browser. Applets have GUI interface but there is not GUI interface in case of Servlets.
 
Your Name Your Email-ID
Your Answer
28. What are the types of Servlet?
  There are two types of servlets, GenericServlet and HttpServlet defines the generic or protocol independent servlet. HttpServlet is a subclass of GenericServlet and provides some http specific functionality link doGet and doPost methods.
 
Your Name Your Email-ID
Your Answer
1234567891011 Page 7 of 11