Java Servlets Question and Answers
21. | What are the objects that are received when a Servlet accepts a call from Client? |
---|---|
|
|
22. | How to track a user session in Servlets? |
---|---|
The interface HTTPSession can be used to track the session in the Servlet. Following code can be used to create session object in the Servlet: HTTPSession session = req.getSession(true). | |
23. | Which are the different ways you can communicate between servlets? |
---|---|
|
|
24. | Why HTTP protocol called as a stateless protocol? |
---|---|
A protocol is stateless if it cannot remember difference between one client request and the other. HTTP is a stateless protocol because each request is executed independently without any knowledge of the requests that came before it. | |