Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Getting Session Info In A Normal Class
cumanji
post May 6 2005, 09:44 PM
Post #1


Newbie [ Level 1 ]
Group Icon

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?
Go to the top of the page
 
+Quote Post
Ola Daniel
post Jun 15 2006, 09:43 PM
Post #2


Newbie [ Level 2 ]
Group Icon

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.
Go to the top of the page
 
+Quote Post
Andres Martinez ...
post Jan 10 2008, 06:21 AM
Post #3


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 19
Joined: 14-December 07
From: Mexico
Member No.: 26,890



QUOTE(Ola Daniel @ Jun 15 2006, 03:43 PM) *
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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Php, Sql Lite: Storing Session's Data?(1)
  2. Total Free Top Level Domain Names!(10)
  3. Need Help - How To Remove Session ID From URL(6)
  4. Can I Put Adsense Ads On My Site At Astahost?(7)
  5. Problem: Account Info(5)
  6. Session And Security(0)
  7. User Authentication Session Handling Problems(14)
  8. How To Delete Files When Session Ends(4)
  9. Alienware New Facelift...(4)
  10. Smf Theme Creation Help(13)
  11. What Are Your Opinions On The Legalization Of Drugs?(4)
  12. Site Info(3)
  13. Disable Crash Recovery Restore Session Option On Firefox 2(3)
  14. Need Info On Database Programming Courses(2)
  15. Basic Info & Download/ Installation Tutorial For Asp.net 2.0(1)
  1. [info] Security(4)
  2. Already Sent Session Cookies?(2)
  3. All About Databases(3)
  4. Anyone Know Of A Really Good Mysql Class?(4)
  5. Php Session Problem(7)
  6. The Witcher Review(1)
  7. Session Save Path Not Set, Unwritable(8)
  8. Run A Script When Expires A Session(6)
  9. Changing Of Hosting Credit To Normal Forum Credit(1)
  10. Use Of Xml Properties File For One Key - Multiple Value Mapping(0)
  11. Php Location Header No Send Session Id ?(0)
  12. Session Issues(1)
  13. My Experience With The Zlob Trojan(1)


 



- Lo-Fi Version Time is now: 13th October 2008 - 05:56 AM