[EJB3 Development] - Maintaining Stateful Session Bean reference across multiple Servlets
by Shankar Vignesh
Shankar Vignesh [https://community.jboss.org/people/shankarvignesh] created the discussion
"Maintaining Stateful Session Bean reference across multiple Servlets"
To view the discussion, visit: https://community.jboss.org/message/735236#735236
--------------------------------------------------------------
Hi,
I am trying to use statful session bean to maintain user related details for particular session(instead of using HttpSession). I am using a instance variable(mName) in my bean with a getter and setter method.
I am using two servlets. First one to set the name and second oe to get the name. When i lookup the bean from two servlets using JNDI lookup i am not able to get the name in second servlet. Then i set the bean lookup got in first servlet to the HttpSession(using session.setAttribute) and get the lookup in the second servlet(using session.getAttribute). Noww i am able to get the name in the second servlet.
My question is "is it a good approach to set the bean lookup in HttpSession and using it in the subsequent requests? is that violates any spec? If it is a violation how should i maintain bean lookup across multple requests>".
Regards,
Shankar Vignesh S
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/735236#735236]
Start a new discussion in EJB3 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
12 years, 7 months