How can we create a HttpSession without a servlet....i mean, an ordinary java class with http session....how do we create this...does any one knows or have a sample coding for it.....please let me know..... Thanks
Hi Thiru, Welcome to JavaRanch, the absolute best site on the www for Java information. We don't have many rules around here, but we do have one. Please change your display name to a first and last name to comply with the JavaRanch Naming Policy. You can change it here. Thank you for your cooperation.
Why in the world would you want to create a HttpSession object outside a web container? But if you really want to do it, just create a class that implements HttpSession.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
You can use a mock session object. The mock objects website gives you one without having to write any code. It can do almost anything a real session object can do. The mock object is intended to be used for testing. If your session object is used in real code, you may want to consider changing the interface. It's better to keep the presentation layer separate. mock objects
Jeanne, that interests me a lot. Two follow-ups: Your link needs an "s" to become http://www.mockobjects.com. And I couldn't find anything on session there. Maybe it didn't need an "s" and I went the wrong place altogether?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi