Interview :: Servlets
11) Can you call a jsp from the servlet?
12) Difference between forward() method and sendRedirect() method ?
forward() method | sendRedirect() method |
---|---|
1) forward() sends the same request to another resource. | 1) sendRedirect() method sends new request always because it uses the URL bar of the browser. |
2) forward() method works at server side. | 2) sendRedirect() method works at client side. |
3) forward() method works within the server only. | 3) sendRedirect() method works within and outside the server. |
13) What is difference between ServletConfig and ServletContext?
The container creates object of ServletConfig for each servlet whereas object of ServletContext is created for each web application.
14) What is Session Tracking?
Session simply means a particular interval of time.
Session Tracking is a way to maintain state of an user.Http protocol is a stateless protocol.Each time user requests to the server, server treats the request as the new request.So we need to maintain the state of an user to recognize to particular user.
15) What are Cookies?
16) What is difference between Cookies and HttpSession?
Cookie works at client side whereas HttpSession works at server side.
17) What is filter?
18) How can we perform any action at the time of deploying the project?
By the help of ServletContextListener interface.