What is the difference between Request, Session and ServletContext | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 20

What is the difference between Request, Session and ServletContext

Question

26th Nov 2019, 12:02 PM
Hmd(inactive)
2 Answers
+ 5
Request basically is the client's request which is passed to the server for processing. For example: suppose a user wants to know some information like total bill amount (shopping website) then the request is send to server, business logics are applied processing is done and then the response is shown back to user. Sessions are the entire conversation that occurs between a server and a client. It can be tracked through cookies or through url rewriting. The moment client forwards a request the session begins and continues until a response is send back to the client. Or it can continue until a time period specified. ServletContext are created during the deploying phase of a web application. It is basically used to get the initializing parameter from web.xml and there is only one ServletContext for your entire web application. Some information or parameters which are required by many servlets in your application are stored using ServletContext.
29th Nov 2019, 6:44 AM
Chetali Shah
Chetali Shah - avatar
+ 16
29th Nov 2019, 7:01 AM
Hmd(inactive)