What is session? Explain its types in servlet technology?



Tracking any kind of user activity is known as Session tracking,
        Session comes in two favor 

                    1. Statefull session
                    2. Stateless Session

Statefull session
It creates a channel between client and server, session will be closed if any one of the end get disturbed. And they need to re-authenticate again to continue their process.
Example: SSH, FTP, Telnet etc

Stateless session
Once the user is authenticated it maintains a token to do the further process, so there is no need to maintain any channel between client and server, the client needs to re-authenticate if the token is lost or expired.
Example: http protocol, all web based application.

The token can be maintained on either client or server side

Consider a web based application, token can be maintained on client using 3 ways
            1. Cookie
            2. URL-rewriting
            3. HiddenForm

Server side Servlets programming.
            1. HttpSession can be used to maintain token on server side.


Related Example
    Login logout example using Cookie
    Login logout example using HttpSession


Related Post

Comments


©candidjava.com