Nov 8, 2009

Getting Session Info In A Normal Class

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > JSP (Java Server Pages)

Getting Session Info In A Normal Class

cumanji
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?

Comment/Reply (w/o sign-up)

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.

Comment/Reply (w/o sign-up)

Andres Martinez Andrade
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

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Session Info Normal


    Looking for session, info, normal, class

See Also,

*SIMILAR VIDEOS*
Searching Video's for session, info, normal, class
advertisement



Getting Session Info In A Normal Class

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com