• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Part II: Cade's usage of a Controller within the Class Diagram & the Sequence Diagrams

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have noticed a strange usage of Controller objects within Cade's example for Part II & III.

In his exemplary class diagram he uses one central Controller object for all views (JSPs). In his subsequent sequence diagram he uses a NoticeController for his CreateNotice.jsp.

First of all, isn't it advisable to design your system to use one central controller, and each view to use its own model (e.g. a backing bean). I've so far not come across multiple controllers, each for a specific view...

Second, if multiple controllers would be advisable, shouldn't these be denoted in the Class Diagram as well?

- Alex
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wanted to ask the same questions as yours.

Ranchers please share your idea on Allexicus's questions.

-Danny
 
author & internet detective
Posts: 42148
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In JSF< a controller contains logic. It's not like other (mostly older) frameworks which use the controller to delegate to an action. Since there is logic, it makes sense to have multiple controllers for different parts of the app. The class diagram should be consistent with the sequence diagrams though.

I added this to the list of issues with the example in the book.
 
Ranch Hand
Posts: 133
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:In JSF< a controller contains logic. It's not like other (mostly older) frameworks which use the controller to delegate to an action. Since there is logic, it makes sense to have multiple controllers for different parts of the app. The class diagram should be consistent with the sequence diagrams though.

I added this to the list of issues with the example in the book.



Hi Jeanne,

Do you mean managed beans for each JSF page?
 
Jeanne Boyarsky
author & internet detective
Posts: 42148
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. The managed beans are sometimes referred to as the controller.
 
Krzysztof Koziol
Ranch Hand
Posts: 133
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Yes. The managed beans are sometimes referred to as the controller.



Did you add Managed Beans in the Component Diagram as separate components?
 
Jeanne Boyarsky
author & internet detective
Posts: 42148
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Krzysztof Koziol wrote:

Jeanne Boyarsky wrote:Yes. The managed beans are sometimes referred to as the controller.



Did you add Managed Beans in the Component Diagram as separate components?


Yes. I don't think it should be that way in the real world, but it seemed important to Oracle.
 
Krzysztof Koziol
Ranch Hand
Posts: 133
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:
Yes. I don't think it should be that way in the real world, but it seemed important to Oracle.



Thanks for this info. Did you somehow show in the Component Diagram that JSPs and Managed Beans are part of JSF framework? Could we use different colors for those components or add <<JSF>> stereotype?

 
Jeanne Boyarsky
author & internet detective
Posts: 42148
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Krzysztof Koziol wrote:

Jeanne Boyarsky wrote:
Yes. I don't think it should be that way in the real world, but it seemed important to Oracle.



Thanks for this info. Did you somehow show in the Component Diagram that JSPs and Managed Beans are part of JSF framework? Could we use different colors for those components or add <<JSF>> stereotype?


Grudgingly. I did put JSPs on the component diagram. I said they were JSPs but didn't connect to JSF there.
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Yes. The managed beans are sometimes referred to as the controller.


1. Jeanne, I agree JSF managed beans(and JSF validators too ?) are sometimes referred to as controllers, but the naming convention used by Cade's book do not suggests this. For example, BidController might not be the managed bean. It seems like a pure controller.

But I am not sure if we can have different controllers in JSF. As FacesServlet is final and we cannot redirect/delegate to specific controllers.

2. Another question in relation: I am using a JSF custom validator for one of the JSF component, can I show it like this in my sequence diagram:




 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nilessh,

1) Even though FacesServlet is final and we can still redirect/delegate to specific controllers on basis of URL pattern configured in FacesServlet. Say /ABC/* will redirect to ABCController.java and /DEF/* will redirect to DEFController.java.

I agree that in Cade's book they have not refered BidController as managed bean, because they have not taken any framework into consideration. But in JSF framework managed bean can do the same work that is done by BidController in Cade's book.

2) I am planning not to show any validator in any of the diagram, in order to be in-sync with Cade's diagrams.

Fellow Ranchers, Please share your opinions on both points!
 
Nilessh Ganu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Gurukant to reply late.

Gurukant Desai wrote:

1) Even though FacesServlet is final and we can still redirect/delegate to specific controllers on basis of URL pattern configured in FacesServlet. Say /ABC/* will redirect to ABCController.java and /DEF/* will redirect to DEFController.java.



Right, but then we are moving away from having a single centralized controller(Front controller).

I am using JSF validators(flow described in my other post) in sequence diagram and component diagram.
Ranchers, does that sounds good ?
 
Gurukant Desai
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nilessh,

That is fine as per Application Controller J2EE design pattern, A front controller can delegate the request processing to Applicaiton Controller.

FacesServlet of JSF is example of FrontController and Managed beans are Application Controllers.

I have not shown any validators in any of my diagrams (As per example in Cade's book). However there is no harm in showing validators. The detailed the better.


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic