How to call ejb from Struts

Showing Answers 1 - 18 of 18 Answers

Suresh Pendyala

  • May 7th, 2005
 

use the Service Locator patter to look up the ejbs.

  Was this answer useful?  Yes

Suresh Pendyala

  • May 7th, 2005
 

Or You can use InitialContext and get the home interface.

  Was this answer useful?  Yes

J. P. Naidu

  • Jul 27th, 2005
 

In the perform method of the Action class u can can drop the code that is responisble for connecting to the EJB. 
 
1. Get Initial Context 
2. Get home object using JNDI 
3 Create the bean and call teh business methods

guptach

  • Sep 23rd, 2005
 

Some Design Patterns are needed in between Action class and EJBs. As the two components are made up of different APIs they both need some interfaces to communicate each other. There are many Design Patterns that can be used to call EJBs. The combinations how we use to call EJBs depends on the Application. We can use Business Delegate, Command Pattern, JDO, Session Facade etc. Out of these Business Delegate and Session Facade combination will work fine for most of the applications.

From Action class we will get the Business Delegate reference(which is a plain java class), which inturn gets Session Facade reference by using the Home object and from Session Facade we will call EJBs.

  Was this answer useful?  Yes

ramanujam

  • Oct 19th, 2005
 

we can use the interceptor pattern to call ejb from the struts it also works good

thnaks and regards

ramanujam

  Was this answer useful?  Yes

subramanum

  • May 15th, 2006
 

Hi,

I am R.Subramanum. I need the briefly concept of "How to call ejb from Struts". I need with example.

Thanks and Regards,

R.Subramanum

  Was this answer useful?  Yes

Chandan Reddy

  • May 17th, 2007
 

I would say follow these pattern:

Subclass your Action class and Override execute() method.
Then in body of execute() method, do this:
1. Get Initial Context 
2. Get home object using JNDI look up.
3 Create the bean and call teh business methods.

-Chandan Reddy

  Was this answer useful?  Yes

kiran

  • May 19th, 2007
 

Yeah I too agree with this, Here action class is client for EJB
First get home interface object using JNDI
then call remote interface reference variable and continue.

  Was this answer useful?  Yes

Yes, we use Service locator design pattern

    We can call from Action Calss through JNDI to home object.      
    then call remote object from home object

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions