I've got 2 beans that don't know about each other (and I do not believe they are EJBs). I need one to access an attribute of another, and I'm thinking there's a way to get ahold of the SessionContext and use that to access the other bean and eventually get a value stored in that bean. I know that when I'm in a servlet's doPost method, I can call something like this:
So when I'm in another bean and don't have access to that HttpServletRequest object, how can I get ahold of that UserAcctBean? Or how can I get ahold of the session? Or do I get ahold of a SessionContext and do something with that? Thanks!
Joined: Jul 15, 2003
I posted a link to this message in the servlet forum in case more readers there would know the answer to this.
If it is an entity bean then it would have been very easy. You can get the refference to the remote object using a context lookup and access any field of that Entity Bean but as you mention that you beans are not EJBs then probably this approach should work. Extend the one bean class by another ans set the scope of bean where ever you are refferencing it as session.
Heya, I am not sure I understand you issue, nut here is a typical remote client code to access an EJB : Context context = new InitialContext(); BeanHome home = (BeanHome)javax.rmi.PortableRemoteObject.narrow(context.lookup(BEAN_JNDI_NAME_FOR_HOME),BeanHome.class); BeanComponent_Interface bean = home.creat<METHOD>(...); int x = bean .method_cal(); // method call Hope this, helps, Cheers
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com