dcsimg
How to get session inside the bean
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   SureshBabu_Subramanian
Posted On:   Monday, March 29, 2004 10:22 AM

Hi,


I am using JSP which uses a bean to display some data. I want to get the httpsession to get the current user in the bean. How to get the httpsession in the bean.
Can anyone help me ?




Thanks in advance,


Suresh

Re: How to get session inside the bean

Posted By:   Peter_Tillemans  
Posted On:   Thursday, April 1, 2004 12:07 AM

I concur with the previous post. It is bad practice to throw these web-layer objects to the EJB layer.

I've been there, I've done that and I lived to feel the pain.

Web layer objects and EJB layer objects do not mix well.

Make a nice little data-object, add the information you need in your bean to it and send that to the EJB layer.

Believe me, it is less work in the end.

Re: How to get session inside the bean

Posted By:   Eran_Harel  
Posted On:   Wednesday, March 31, 2004 11:56 PM

Why don't you simply pass the current user as the argument to the method you are calling?

Passing an object like Http Request or Http Session couples your bean to the web environment.

Re: How to get session inside the bean

Posted By:   Gajanan_Choudhari  
Posted On:   Monday, March 29, 2004 11:43 PM

Hi,
To use httpsession, you can use scope=session with jsp:useBean .
Regard,
Gajanan

Re: How to get session inside the bean

Posted By:   Jitendra_Agrawal  
Posted On:   Monday, March 29, 2004 11:59 AM


Hi,

I normally pass the 'request' object to beans being used by JSP if session information is required by bean.

Hope this helps,
Jitendra Agrawal.

Fixed Line SMSC
About | Sitemap | Contact