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>".