[jboss-dev-forums] [EJB3 Development] - Maintaining Stateful Session Bean reference across multiple Servlets

Shankar Vignesh do-not-reply at jboss.com
Sun May 13 06:48:31 EDT 2012


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&containerType=14&container=2030]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120513/6d4016f7/attachment.html 


More information about the jboss-dev-forums mailing list