the mvc structure within ejb layer

Discussions

EJB design: the mvc structure within ejb layer

  1. the mvc structure within ejb layer (5 messages)

    hello
    i am familiar with the mvc structure in the web layer,but i wonder how can i implement the mvc struction in the ejb layer.

    i can use the stateless session bean as the controller,but in the web layer,i can use the url to identify the different request,and path information,but in the ejb container,it seem like there isn't such machanism,how can the controller(session bean) reforward the different request?where can i find the sample code of the sessin bean controller?is it included within the petstore?
    thank you!

    Threaded Messages (5)

  2. the mvc structure within ejb layer[ Go to top ]

    Paass the request to Servlet as controller ,then servlet pass the request to Java Class(JavaBean)as Service class , in the service class will look up call call the Stateless Session Bean.Set the attributes in Service class then forward request to JSP.This pattern ur using in current project.

    Suresh Devaravar
  3. the mvc structure within ejb layer[ Go to top ]

    hello
    what you have mentioned is still web layer mvc structure,do you hear of the ejb layer mvc structure?

    i find it from a book,but i can't remember the name of the book,this book don't give me the detailed description and code sample,what i have remembered is that it use the STATELESS SESSION BEAN as the controller,the controller forward the request to the processing model just like the web layer mvc structure,i think it is the better structure to the ejb layer,it can decouple the web layer and ejb layrer.but i can't find the sample in the real world.i think the session controller should be some thing like a session facade to hide the other session facade.but this is only my guess,i don't know if there is the standard model for the ejb layer mvc structure,or maybe it is only a alias to the session facade.
  4. the mvc structure within ejb layer[ Go to top ]

    I wonder how you can implement the View part of MVC using EJBs :)

    It is a common practice to use SBs as controllers for the entity beans or data access objects (model).

    The basic idea is that the SBs provide a coarse-grained interface to the underlying more fine-grained logic.
  5. the mvc structure within ejb layer[ Go to top ]

    Sounds like you want something like the EJB Command pattern -- which I believe is documented in the EJB Pattern Book that's found in the "Books & Articles" section of the site.

    In simplest of terms.. you have a Controller Session Bean (often a Stateful SB) that accepts a Command or Action class. This class typically has the logic for executing a particular action or usecase --- so it will generally know what beans, etc.. should be called and in what order. In this scenario the Controller SB would simply execute the Command / Action.

    You had mentioned the petstore.. I believe that the petstore also uses the pattern, or did so at one point (I havent looked at some of the more recent versions).

    Now this pattern does have its drawbacks. If your primary concern is decoupling the bus and the pres/web tiers than using a combination of a business delegate(s) and session facade(s) would give you a clear separation. I personally favor the business delegate / facade approach.
  6. the mvc structure within ejb layer[ Go to top ]

    thanks
    that is what i want,maybe the mvc is not the qppropriate title.