GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Struts
Go To First  |  Previous Question  |  Next Question 
 Struts  |  Question 6 of 103    Print  
How to call ejb from Struts

  
Total Answers and Comments: 10 Last Update: October 29, 2008   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: J. P. Naidu
 
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

Above answer was rated as good by the following members:
geeksterrahul
May 07, 2005 16:35:00   #1  
Suresh Pendyala        

RE: How to call ejb from Struts
use the Service Locator patter to look up the ejbs.
 
Is this answer useful? Yes | No
May 07, 2005 23:20:01   #2  
Suresh Pendyala        

RE: How to call ejb from Struts
Or You can use InitialContext and get the home interface.
 
Is this answer useful? Yes | No
July 27, 2005 13:57:44   #3  
J. P. Naidu        

RE: How to call ejb from Struts
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

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
September 23, 2005 18:41:45   #4  
guptach Member Since: September 2005   Contribution: 10    

How to call ejb from Struts

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.


 
Is this answer useful? Yes | No
October 19, 2005 02:56:04   #5  
ramanujam        

RE: How to call ejb from Struts

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

thnaks and regards

ramanujam


 
Is this answer useful? Yes | No
May 15, 2006 03:08:44   #6  
subramanum        

RE: How to call ejb from Struts

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


 
Is this answer useful? Yes | No
February 24, 2007 14:09:54   #7  
sivanesh.a Member Since: December 2006   Contribution: 189    

RE: How to call ejb from Struts
1. Get Initial Context
2. Get home object using JNDI
3 Create the bean and call teh business methods

 
Is this answer useful? Yes | No
May 17, 2007 19:51:47   #8  
Chandan Reddy        

RE: How to call ejb from Struts
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

 
Is this answer useful? Yes | No
May 19, 2007 10:23:13   #9  
kiran        

RE: How to call ejb from Struts
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.

 
Is this answer useful? Yes | No
October 29, 2008 01:44:15   #10  
Purushotham2007 Member Since: October 2008   Contribution: 1    

RE: How to call ejb from Struts
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

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape