Q)How can a servlet communicate with another servlet? =>By using request dispatching. =>Request dispatching is implemented as follows. Step 1:- creating RequestDispatcher object. RequestDispatcher requestDispatcher=request.getRequestDispatcher("public URL name of the other servlet"); Step 2:- call forward() / include() method on the RequestDispatcher object. For eg. requestDispatcher.forward(request,response); For eg. public class MyServlet1 extends GenericServlet { public void service(ServletRequest request,ServletResponse response) { RequestDispatcher rd=request.getRequestDispatcher("/hello"); rd.forward(request,response);//inter-servlet communication } } public class MyServlet2 extends GenericServlet { public void service(ServletRequest request,ServletResponse response) { } } one MyServlet1 two MyServlet2 one /hai two /hello Note:- In case of forward() mechanism of request dispatching, the second servlet is responsible to build the response for the client. In case of include() mechansim of request dispatching,the first servlet is responsible to build the response for the client. Q)What are the frequently used HTTP methods? 1)GET 2)POST Q)What is the general structure of HttpServlet? =>In realtime Java web applications, a servlet never inherits GenericServlet. It inherits javax.servlet.http.HttpServlet For eg. public class MyServlet extends HttpServlet { public void init() { //resource allocation if any } public void destroy() { //resources deallocation } public void doGet/doPost(HttpServletRequest request,HttpServletResponse response) { } } Note:- If the client makes a request to the web server using HTTP GET method, doGet() method of the servlet is called. =>If the request is of POST type, doPost() method is called. Note:- doGet() /doPost() act as the service method of a servlet as request handling code is written here. Q)Does Servlet Container call doGet()/doPost()? =>No. =>Servlet Container calls service method only. From within the service method, based on the HTTP request method, doGet()/doPost() is called. Q)When is GET/POST request used? =>When the web form is submitted, if DML operation is performed in the back-end, request type is POST only. =>When the web form is submitted, if DRL operation is performed in the back-end, request type is GET only. Note:- In the web form, if any sensitive information is getting passed, for example user name & password, for security reasons, POST method only to be used.