File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Ejb in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Ejb in Struts" Watch "Ejb in Struts" New topic

Ejb in Struts

priya shankar
Ranch Hand

Joined: May 12, 2003
Posts: 51
Hi all
In struts where(M,V,C)the Ejb is going to reside...Pls Explain.

Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
struts is a layer for the presentation layer.
ejb are used in business or integration layer.
You should use J2EE Patterns (search on Sun site, there is a catalog) to communicate between presentation layer classes (struts) and business layer. (for example service locator and Business delegate).
regards Axel
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
this text from Nadir Gulzars Pratical J2EE App book might make things clearer. (think this chapter was or is for free download on

For distributed applications, an action class houses the control logic required for interacting
with business logic in EJB components and will typically use a Business Delegate[Core] object for
this purpose. Business delegate shields the request handlers from having to deal with the complexity of accessing distributed components. The business delegate design pattern promotes loose coupling between the request handlers and the server side components since the logic for accessing server side components is embedded in the business delegate. A request handler is written by a developer working in the presentation tier, while a business delegate is usually written by a developer responsible for creating the business tier services.

in big j2ee apps with ejb business logic is outside of struts.

For smaller non-distributed applications, the action class may contain business logic. When distributed processing in not required and business logic is embedded in request handlers, a Data Access Object [Core] can be used to abstract the underlying data access implementation; this provides a loose coupling between the request handlers and the data access layer, thus protecting the presentation tier from implementation changes in the integration tier.
The base Action class of request handlers provides several convenience methods, please refer to the
API documentation at

in struts apps without struts business logic is (often) in struts action classes.
[ June 07, 2003: Message edited by: Axel Janssen ]
I agree. Here's the link:
subject: Ejb in Struts
It's not a secret anymore!