• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using stateful and stateless session bean together, what happens?

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using a session facade called controller class, but I can't decide what type it should be?


behind it are all stateless session beans, like searchManager class, etc

so must this controller be stateless too? or else all the stateless beans behind it will "turn" stateful !!??

How JEE handles this scenario? a stateful bean calls stateless beans

Many thanks !!
 
li tiangong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and in such case, Can I say this controller class is a servlet?
 
li tiangong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I seem to have made a mistake:

commonly, a servlet class should call a session facade to access beans

in my case, I put servlet and session facade as one class: controller

Is this definitely wrong??
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Definitely.
 
li tiangong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cameron Wallace McKenzie wrote:Definitely.



omg,iam going to fail
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A front controller (Servlet) invokes a session facade (stateless session bean).

That's a very fundamental pattern and implementation.
 
li tiangong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, I am confused with one example solution, which is :

jsp pages --> controller --> stateless session beans


in such case, what should this controller be?

there is only one class between jsps and stateless session bean, what pattern might this better be?

thanks! I will change my name if you answer me

 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Google "Front Controller" and you will find many discussions on this particular pattern.

Front Controller Design Pattern

The easiest way to implement this is to simply say you are using Sun's JSF framework. The JSF framework provides its own Front Controller, the FacesServlet. Just say your application will be using this Servlet as your front controller, and you're done.
 
li tiangong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cameron Wallace McKenzie wrote:Google "Front Controller" and you will find many discussions on this particular pattern.

Front Controller Design Pattern

The easiest way to implement this is to simply say you are using Sun's JSF framework. The JSF framework provides its own Front Controller, the FacesServlet. Just say your application will be using this Servlet as your front controller, and you're done.



so you mean, there must be a front controller (FacesServlet), and my controller class is then session facade .

Thanks a lot

 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm worried that you have the idea of a command pattern and a controller pattern confused. I think you need to define what a controller is to you, and what its purpose is.

Based on the Command pattern [GoF], the Command and Controller Strategy suggests providing a generic interface to the helper components to which the controller may delegate responsibility, minimizing the coupling among these components (see "View Helper" on page 33 for more information on helper components). Adding to or changing the work that needs to be completed by these helpers does not require any changes to the interface between the controller and the helpers, but rather to the type and/or content of the commands. This provides a flexible and easily extensible mechanism for developers to add request handling behaviors.



You seem to be describing a scenario where a controller calls on GOF commands?



These quotes and images are from the following link:

Suns J2EE Core Design Patterns

 
li tiangong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it's the sample solution from that famous author, I can't remember name

so what do you think his controller class is doing?

I can paste the whole image if you need.



controller.jpg
[Thumbnail for controller.jpg]
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks to me like the controller class is invoking a manager class.

Please quote your sources. If this is from an authors copyrighted work, posting it here may very well be a copyright violation.
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
good discussion.

If the faces servlet is your front controller what if I need to have my own front controller? My question is if I start using JSF is my own front controller not relevant at all?
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One front controller is more than enough.

I have seen plenty of architects build frameworks around frameworks, and it's a mess.

I'm not sure of a business scenario where you'd capture a request with a front controller, and pass it to another front controller. You can always extend the FacesServlet to provide extra functionality to your front controller.
 
li tiangong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cameron Wallace McKenzie wrote:It looks to me like the controller class is invoking a manager class.

Please quote your sources. If this is from an authors copyrighted work, posting it here may very well be a copyright violation.



it's by Humphrey Sheil in his new SCEA guide book chapter nine

yes controller calls several manager classes, manager classes manage some entity classes.


I think, he omits servlet layer classes, coz less important, and in such case, controller is session facade

and it can't be a front controller becoz it's behind all jsp pages ,not in front.


what do you think?
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the controller is a Session Facade, then why is it not marked with an EJB annotation like the Manager classes? That would indicate to me that it is not an EJB,and thus, not a Session EJB, and thus, not a Session Facade. Besides, an EJB doesn't take http requests. The controller would need to be implemented as some type of Java artifact that can be invoked through the http protocol, especially if it is accepting requests from a JSP.

 
li tiangong
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
another diagram:

so understand it in this way: in Humphrey Sheil's diagram, controller is a servlet, it's not using service locator (like in this, don't know from where diagram) but dependency inject to talk to manager classes

if there is any pattern here, it's DI only

34386160.jpg
[Thumbnail for 34386160.jpg]
reply
    Bookmark Topic Watch Topic
  • New Topic