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. | |
26. | What is a servlet? |
---|---|
|
|
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. | |
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. | |