1

This is how i create session in LoginAction

HttpSession session=request.getSession(false);

            if(session!=null)
    {
       session=request.getSession(true);

       if(!session.isNew())
       { ........
                 //Business Logic
               }
}

And i maintained session in all other Actions as HttpSession session=request.getSession(false);

               if(!session.isNew())
       { ........
                 //Business Logic
               }else{
                  //redirected to error page
                 }

And i INVALIDATED SESSION IN LOGOUTaCTION AS

                    if(session!=null)
                    {
        response.setHeader("Cache-Control","no-cache,no-                                     store,mustrevalidate");
             //set cache-control header to disable caching  (HTTP/1.0(older) spec)..                          because some old clients might not support the no-cache header above 
        response.setHeader("Pragma","no-cache");
                //set dateHeader to prevent caching at the proxy server
        response.setDateHeader("Expires",0); 

        session.invalidate();
    }

In general when user logs in, top right corner of the website his name is displayed.Now the problem scenario is when two users logs in (suppose user1 and user2).User2 will see a bug(i.e.,User1 name being displayed on top corner) and vice versa.

................................................Any help would be greatly appreciated.:-)

4

0 回答 0