bookmark - Getting Session Info In A Normal Class

Getting Session Info In A Normal Class

 
 Discussion by cumanji with 2 Replies.
 Last Update: January 10, 2008, 6:21 am
 
bookmark - Getting Session Info In A Normal Class  
    
free web hosting
 
Hello, i want to get session info from a class that is not servlet (generally from in a bean). When we use servlets it is so easy to get session info by just using request.getSession() method. Is it possible to get this session info by importing a class?
We can get info about application config by using ServletConfig class. Is there a class to like ServletConfig to get info about session/application?

Fri May 6, 2005    Reply    New Discussion   


Technically there is no way to get the web session from a normal java class (POJO).


However if you wire your POJO into a web application using the J2EE MVC
pattern or FrontController pattern.i.e JSP submits to servlet, servlet passes the HttpServletRequest Object to POJO or bean. You can access your web session, your servlet context throught the request obejct.

I suggest you do some research on MVC and FrontController design patterns.

Thu Jun 15, 2006    Reply    New Discussion   

QUOTE (Ola Daniel)

Technically there is no way to get the web session from a normal java class (POJO).
However if you wire your POJO into a web application using the J2EE MVC
pattern or FrontController pattern.i.e JSP submits to servlet, servlet passes the HttpServletRequest Object to POJO or bean. You can access your web session, your servlet context throught the request obejct.

I suggest you do some research on MVC and FrontController design patterns.
Link: view Post: 80820


Does any one has an easy sample code to manage the session? I have done this only in php and I want to do the same with Java Server Pages.
I want to know how to create the session, how to destroy the current session and clear all variables, how to get the session id and how to read the session variables.

Thanks

Thu Jan 10, 2008    Reply    New Discussion   

Quickly Post to Getting Session Info In A Normal Class  w/o signup Share Info about Getting Session Info In A Normal Class  using Facebook, Twitter etc. email your friend about Getting Session Info In A Normal Class Print
Reply / Comment Ask a Question? Share / Bookmark E-Mail a Friend Print

JSP To SMS JSP to SMS  JSP To SMS JSP to SMS (4) (18) Uploading Image File Through JSP Code To Server   Uploading Image File Through JSP Code To Server