• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Questions regarding BaseController and other controllers

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
in my SCEA Part-2 assignment, I am showing a BaseController with <<Servlet>> stereotype in the class diagram. (This BaseController is actually the FacesServlet in JSF). I am also showing in the class diagram some other controllers like SecurityController, XXXController with <<ManagedBean>> stereotype. And I am depicting that the BaseController(which is a servlet) is using the other controllers(which are maanged beans).
I have the following questions:
1. Is this approach right?
2. I am showing the FacesServlet as BaseController and also naming the managed beans as Controller(e.g. SecurityController).Actually I am trying to follow Cade's example where there are BidController, NoticeController etc. Am I doing the right thing?
3. Following the Cade's example, in the Component diagram I am showing the related group of JSP's and Controllers as a single component (Though Cade's example has shown only the JSPs). Please provide your opinion about this.
 
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 think you are good on all counts as you are showing more information not less. I am not even showing JSF controller in my class diagram because it is not my class and my diagram is already cluttered. Calling managed beans as controllers is also fine as they are part of the controller of the MVC pattern.
 
viv anand
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Saket, thanks for your reply. One correction- For JSF, ManagedBean is the Model of MVC pattern and FacesServlet is the Controller of MVC.

It will be of great help if other ranchers (like Saket) give their opinion. Please share your opinion.
 
Saket Mittal
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why cant they be both ? Managed beans can be action handlers and action handlers are part of the controller along with the faces controller. They are also model because they could contain presentation data. Right ?
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

viv anand wrote:Hi,
in my SCEA Part-2 assignment, I am showing a BaseController with <<Servlet>> stereotype in the class diagram. (This BaseController is actually the FacesServlet in JSF). I am also showing in the class diagram some other controllers like SecurityController, XXXController with <<ManagedBean>> stereotype. And I am depicting that the BaseController(which is a servlet) is using the other controllers(which are maanged beans).
I have the following questions:
1. Is this approach right?
2. I am showing the FacesServlet as BaseController and also naming the managed beans as Controller(e.g. SecurityController).Actually I am trying to follow Cade's example where there are BidController, NoticeController etc. Am I doing the right thing?
3. Following the Cade's example, in the Component diagram I am showing the related group of JSP's and Controllers as a single component (Though Cade's example has shown only the JSPs). Please provide your opinion about this.



I am using a single Front controller(which is FacesServlet) centrally delegating specific requests to more specific controllers. If we map this to Cade's examples, I am showing a Controller delegating the requests to BidController, NoticeController.
However I am not using the backing beans as controllers.

The idea behind delegating the requests to different controllers is to provide different custom pre/post processing of requests to each of the controllers.
Does it sounds good ?
 
viv anand
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for your reply . Yes, I think ManagedBean can act as a controller.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This was good discussion and one question i have is this may be offrelated to the topic. Anyways I'm kindoff new to the JSF and from the examples what i have seen is ManagedBean/Backing can be used to display the data on the Pages. At the sametime are these beans can also be used as the controllers?

Sory If i posted my question in wrong thread.

Thanks,
 
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

viv anand wrote:Thank you all for your reply . Yes, I think ManagedBean can act as a controller.


Looking at the post, I am convinced that class diagram should be framework agnostic. So I am going ahead with a single controller in the class diagram.
I am also not showing the managed beans in class diagram.

Class diagram:

JSF page >> Controller >> SLSB

Sequence diagram:

JSF page >> Controller >> backing beans >> SLSB

My assumption is that the Controller used here is Facesservlet.
Does this sounds good ?

Only question remain in my mind is are BidController/NoticeControllers shown in sequence diagram are some kind of backing beans?
Is the convention correct to name the backing beans as 'xxxController' ?

Thanks.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nilessh, I think that should be fine by looking at Jeanne's reply in this thread.
https://coderanch.com/t/521637/java-Architect-SCEA/certification/Part-II-Cade-usage-Controller

Jeanne, Please confirm.
 
author & internet detective
Posts: 41967
911
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. I still agree with my opinion. Thanks for finding where I replied earlier .
 
Forget Steve. Look at this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic