Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

How to call EJB (Session beans) using Struts framework?  RSS feed

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

I am trying to find out what is the best way to call business logic components (eg. session beans) using the Struts framework.

I have read that the Action class can be used along with a Business Delegate pattern and Session facade to accomplish this. Is this the only way to do this, are there any other options? I am interested to know how exactly is it done in big enterprise level applications?

If there are any tutorial links or sample code I would be extremely grateful! Will really appreciate any thoughts.
 
author & internet detective
Posts: 39054
714
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meghna,
There are other options. You can do anything you want. The one you described is a common pattern with a clean design.
 
author and cow tipper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code, I love code.

Here is some code for calling remote stateful (SFSB)and stateless session EJBs (SFSB). In these examples, I just do it from a Servlet. There's lots of drawbacks to that, not to mention the tight coupling of the Servlet to the EJB. Your analogy would be tight coupling from the Struts action class to the EJB. Same difference.

The more layers, and more design patterns you use, typically decouples your control layer from your logic layer. That's typcially a good thing.

For some EJB development tutorials, including the multimedia tutorial that shows you how to create the EJBs used in the code below (I copied and pased the code from the tutorial), then check out the following link:

Free Multimedia Tutorials on J2EE Develoment with EJBs, Servlets, POJOs and JavaBeans (CBTs)




-Cameron McKenzie
 
Meghna Bhardwaj
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Cameron. Great example, appreciate it!
 
Morning came much too soon and it brought along a friend named Margarita Hangover, and a tiny ad.
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!