JaiswalTraining

Get the online training



Corejava Servlet Jsp  Php  Hibernate  Ajax Web Service   Ejb2.1 Ejb3.0 Struts Struts2  JPA Spring Ibatis   JSF    JSF2.0  CoreJavaDesignPattern    Jquery  Flex J2EE-Design-Patterns  Jboss7  Maven  Contact Me                                                                                                                                                                        
            IGNOU SMU PTU Project                                           Training                                                                                                                              
              

Contact Us  0091- 9210721663         jaiswaltraining@gmail.com




Corejava
Servlet
Jsp
Php
Hibernate
Ajax
Web Service
Ejb2.1
Ejb3.0
Struts  
Struts2
JPA
Spring
Ibatis
JSF
JSF2.0
CoreJavaDesignPattern
Jquery
Flex
J2EE-Design-Patterns
Jboss7
Maven







Session Tracking

  • Implementing session tracking from scratch

  • Using basic session tracking

  • Understanding the session-tracking API

  • Differentiating between server and browser sessions

  • Encoding URLs

  • Storing immutable objects vs. storing mutable objects

  • Tracking user access counts

  • Accumulating user purchases

  • Implementing a shopping cart

  • Building an online store

Session

It is the interaction between client with the server.Server maintains the session with the client by making a fixed time interval and a session id.Till the client is inetracting with the server his session will be maintained.But if stops interacting with the server then after a fixed session interval his session will get destroyed.

Session is very important as all values can be kept by the client in the session.
This way overload to the server is maintained.It is partially maintained by the cookie as the session id is kept in the cookie.

Each browser is having separate cookie
In web programing HTTP  protoclo is most used.HTTP protocol is stateless.So it cannot maintain the server.

Session Id

  • When ever a client is interacting the server an id is generated  by the server.
  • Request from the server passes tothe WebServer.
  • WebServer pass these request to the  given Servlet.
  • Servlet creates a Session Objects on to the  Server.

             
  • This session is having unique id.
  • The generated  id is passed  to the client using the response Object.
  • It  is added to the Cookie in the given browser.
  • Every browser is having differrent Cookie.
  • So each browser is having differrent Session id.

             
Session API

public interface javax.servlet.http.HttpSession{
    public abstract long getCreationTime();
    public abstract java.lang.String getId();
    public abstract long getLastAccessedTime();
    public abstract javax.servlet.ServletContext getServletContext();
    public abstract void setMaxInactiveInterval(int);
    public abstract int getMaxInactiveInterval();
    public abstract javax.servlet.http.HttpSessionContext getSessionContext();
    public abstract java.lang.Object getAttribute(java.lang.String);
    public abstract java.lang.Object getValue(java.lang.String);
    public abstract java.util.Enumeration getAttributeNames();
    public abstract java.lang.String[] getValueNames();
    public abstract void setAttribute(java.lang.String, java.lang.Object);
    public abstract void putValue(java.lang.String, java.lang.Object);
    public abstract void removeAttribute(java.lang.String);
    public abstract void removeValue(java.lang.String);
    public abstract void invalidate();
    public abstract boolean isNew();
}


Session is present in the form of

  • HttpSession  interface in the package http.
  • request Object returns the session object   with getSession() method
  • This session is set as Cookie in the Client browser