A servlet maintain session in

Options
- Servlet container
- Servlet context
- Servlet request heap
- Servlet response heap


CORRECT ANSWER : Servlet context

Discussion Board
Session management

Servlet session is maintained in servlet context and it is being provided by HTTP. HTTP is a stateless protocol that is each time a client retrieves a Web page, the client opens a separate connection to the Web server the server never keep any record of previous client request.

There are three ways to maintain a session between web client and web server:
1) Cookies are good way to maintain session as the webserver can assign unique session ID as cookie to each client and receives the replies from the client that can be stored as the received cookie.

2) Hidden Form Fields- this is another way to maintain session it can be done using a web server having a hidden HTML form field along with a unique session ID as follows:

<input type="hidden" name="sessionid" value="12345">

when the form is submitted, the specified name and value are automatically included in the GET or POST data.

3) URL Rewriting- this happens when some extra data is appended at the end of each URL that identifies the session, and the server can associate that session identifier with data it has stored about that session.

Rohit Sharma 11-29-2014 10:23 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement