|
|
|
|
![]() ![]() |
May 6 2005, 09:44 PM
Post
#1
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 5 Joined: 6-May 05 Member No.: 4,799 |
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? |
|
|
|
Jun 15 2006, 09:43 PM
Post
#2
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 15 Joined: 15-June 06 Member No.: 13,954 |
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. |
|
|
|
Jan 10 2008, 06:21 AM
Post
#3
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 19 Joined: 14-December 07 From: Mexico Member No.: 26,890 |
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. 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 |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 13th October 2008 - 05:56 AM |