File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Help me in designing an J2EE application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Help me in designing an J2EE application" Watch "Help me in designing an J2EE application" New topic
Author

Help me in designing an J2EE application

saran sadaiyappan
Ranch Hand

Joined: Dec 23, 2004
Posts: 39
Hi all,
I have an application which used jsps ans servlets as web layer and POJO as business layer and DAO s as data base layer.

Now the question is, if I want to redesign this using EJBs how ll I do? I will retain the JSP pages as such and populate a DTO from the JSP inputs, call a session bean in the servlet for performing all business logics, and an entity bean will be used for doing the data base updates.

Is this design Ok?
I have a doubt whether I can use servlet to call a session bean. Any better design or suggestions?
S Venkatesh
Ranch Hand

Joined: Jun 27, 2005
Posts: 464

Hai,

I prefer calling the session bean through a delegate. Better use a delegate between the servlet and the sessionbean. Rest is fine i guess.

Regards
Venkatesh S
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Technically, there is no problem in calling an EJB from a servlet (or JSP, Struts Action, Swing, etc). But you can certainly argue that the client should not know how the business logic is implemented. My preference is to use a business delegate between the servlet and EJB. The client invokes business methods on the BD and the BD invokes the required methods in the business logic layer. This layer might consist of just POJOs today, tomorrow it might consist of EJBs and POJOs.

I suggest you implement the BD first, then add EJBs.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Franck Smith
Greenhorn

Joined: Dec 21, 2005
Posts: 18
Use of Business Delegate is a j2ee design patterns that have a lot of advantages. Most important patterns to implement if you decide to use EJB : Service Locator (use to look up your ejb) and Proxy(use to make separation and abstraction between your presentation layer and the ressource one).

I recommend you to see the sun documentation about it :
http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html

Don't forget to think about packaging of your j2ee module then will contain at least 2 j2ee module now so that you can use the j2ee application classloading advantages.
saran sadaiyappan
Ranch Hand

Joined: Dec 23, 2004
Posts: 39
Hi all,
Thanks for all your valuable feedback. I came to know about what is a business delegate object and I will implpement the same.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I use a vendor framework with proprietary a BD architecture. Inside it does its own marshalling and then uses strategies to make the service call via native Java methods, EJB, raw sockets, XML/HTTP, JMS, etc. So the BD methods are the business methods on the remote object and the strategy methods are about making remote calls to any service with any set of parameters. Cool stuff.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
I recommend you to see the sun documentation about it :
http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html


is there any framework available (open-source or vendor implementation) that implement Business Delegate pattern ?


Don't forget to think about packaging of your j2ee module then will contain at least 2 j2ee module now so that you can use the j2ee application classloading advantages.


don't quite understand. what is class loading? , 2 EAR files for load balancing?

thanks all
tony


SCJP 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help me in designing an J2EE application