Hi all,
I'm facing the problem that , how to call an EJB from servlet or JSP page. What's the procedure to call an EJB from servlet or JSP page? Please give sample code here...
Thanks in advance!!!!
regards,
DSR Kumar.
-
How to call any EJB from a servlet/JSP (2 messages)
- Posted by: Seetharam kumar Devarasetty
- Posted on: August 22 2005 05:48 EDT
Threaded Messages (2)
- How to call any EJB from a servlet/JSP by Gabriel Dayley on August 22 2005 18:08 EDT
- Response by petr zuska on August 23 2005 11:04 EDT
-
How to call any EJB from a servlet/JSP[ Go to top ]
- Posted by: Gabriel Dayley
- Posted on: August 22 2005 18:08 EDT
- in response to Seetharam kumar Devarasetty
more than likely you would do an jndi lookup -
Response[ Go to top ]
- Posted by: petr zuska
- Posted on: August 23 2005 11:04 EDT
- in response to Seetharam kumar Devarasetty
Hi, here is simple source code (use jndi)
//get jndi context, if servlet is in same JVM else put
//paramter Properties
Context ctx = new InitialContext(null);
//get Home interface of bean
//narrow -retype
BeanHome lhome = (BeanHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("cz.train.Bean"), BeanHome.class);
//get remote interface
Bean lbean = lhome.create();
//now you can call bussiness method on remote interface like
lbean.doSomething()
Petr Zuska