18/02/25 ----------- Q)What are the most frequently used HTTP request methods? 1)GET 2)POST Q)When are GET and POST used? =>to get data from the database without affecting data in the database, we go for GET request. For eg. Viewing result (GET) Note:- secured information like user names and paswords, CREDIT card numbers etc.involved we should not use GET even though READ operation is performed on the database. =>Whenever DML oeprations are involved we go for POST. Q)What is the hierarchy of servlets? DIAGRAM Note:- Always a user defined servlet should inherit from HttpServlet. Q)Which is the servicing method of a realtime servlet? =>doGet() or doPost() For eg. public class MyServlet extends HttpServlet{ public void doGet/doPost(HttpServletRequest request,HttpServletResponse response) { //duties of a servlet } } Q)Can Servlet Container call doGet/doPost() ? =>No. Can't call as they are not life cycle methods. Q)When is doGet() called? =>When HTTP request method is GET type. Q)When is doPost() called? =>When HTTP request method is POST type. Q)How are protocols classified? 1)stateless protocol 2)stateful protocol =>If server has got no memory of prior connections, the protocol is said to be stateless. If it has, it is stateful. =>FTP(File Transfer Protocol) is a stateful protocol. =>HTTP is a stateless protocol. Note:- HTTP provides better performance but poses some challenges to the web application developers as user interaction with the website should be stateful.