Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6377687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:54:24+00:00 2026-05-25T01:54:24+00:00

I recently read this article from Neil Griffin Making Distinctions Between Different Kinds of

  • 0

I recently read this article from Neil Griffin Making Distinctions Between Different Kinds of JSF Managed-Beans and it got me thinking about the distinction between different beans in my own application. To quickly summarise the gist:

  • Model Managed-Bean: This type of managed-bean participates in the
    “Model” concern of the MVC design pattern. When you see the word
    “model” — think DATA. A JSF model-bean should be a POJO that follows
    the JavaBean design pattern with getters/setters encapsulating
    properties.

  • Backing Managed-Bean: This type of managed-bean participates in the
    “View” concern of the MVC design pattern. The purpose of a
    backing-bean is to support UI logic, and has a 1::1 relationship with
    a JSF view, or a JSF form in a Facelet composition. Although it
    typically has JavaBean-style properties with associated
    getters/setters, these are properties of the View — not of the
    underlying application data model. JSF backing-beans may also have JSF
    actionListener and valueChangeListener methods.

  • Controller Managed-Bean: This type of managed-bean participates in
    the “Controller” concern of the MVC design pattern. The purpose of a
    controller bean is to execute some kind of business logic and return a
    navigation outcome to the JSF navigation-handler. JSF controller-beans
    typically have JSF action methods (and not actionListener methods).

  • Support Managed-Bean: This type of bean “supports” one or more views
    in the “View” concern of the MVC design pattern. The typical use case
    is supplying an ArrayList to JSF h:selectOneMenu drop-down
    lists that appear in more than one JSF view. If the data in the
    dropdown lists is particular to the user, then the bean would be kept
    in session scope.

  • Utility Managed-Bean: This type of bean provides some type of
    “utility” function to one or more JSF views. A good example of this
    might be a FileUpload bean that can be reused in multiple web
    applications.

This made sense to me and for the past few hours I have been refactoring my code and came up with the following with respect to the user login:

The AuthenticationController is an example of a Controller Managed-Bean. It is request-scoped and features two getters and setters for setting a username and password, and two navigation methods, authenticate and logout, navigating the user to either their private area upon successful login, or back to the main page when logging out.

The UserBean is an example of a Support Managed-Bean. It is session-scoped and features an instance of User class (which would be null when you are not authenticated) with a getter and setter, nothing more.

The AuthenticationController has this user as a managed property (@ManagedProperty(value = "#{userController.user} private User user;). Upon successful authentication, the AuthenticationController would set the managed property to the actual user instance with the corresponding username that was used for the login.

Any new beans would be able to grab the user as a managed property as well and pull the data they need, such as group membership for instance, if the User class would feature a list with group names.

Would this way be the proper way to go about with regard to the seperation of concerns?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:54:25+00:00Added an answer on May 25, 2026 at 1:54 am

    This is a very subjective question. I personally disagree that article and find that it’s giving really bad advice to starters.


    Model Managed-Bean: This type of managed-bean participates in the “Model” concern of the MVC design pattern. When you see the word “model” — think DATA. A JSF model-bean should be a POJO that follows the JavaBean design pattern with getters/setters encapsulating properties.

    I would absolutely not make or call it a managed bean. Just make it a property of a @ManagedBean. For example a DTO or JPA @Entity.


    Backing Managed-Bean: This type of managed-bean participates in the “View” concern of the MVC design pattern. The purpose of a backing-bean is to support UI logic, and has a 1::1 relationship with a JSF view, or a JSF form in a Facelet composition. Although it typically has JavaBean-style properties with associated getters/setters, these are properties of the View — not of the underlying application data model. JSF backing-beans may also have JSF actionListener and valueChangeListener methods.

    This way you keep duplicating and mapping the properties of the entity in the managed bean. This makes no sense to me. As said, just make the entity a property of the managed bean and let the input fields refer it directly like #{authenticator.user.name} instead of #{authenticator.username}.


    Controller Managed-Bean: This type of managed-bean participates in the “Controller” concern of the MVC design pattern. The purpose of a controller bean is to execute some kind of business logic and return a navigation outcome to the JSF navigation-handler. JSF controller-beans typically have JSF action methods (and not actionListener methods).

    This describes the @RequestScoped/@ViewScoped @ManagedBean class pretty much. Whether event listener methods are allowed or not depends on whether they are specific to the view which is tied to the bean and/or are for their job dependent on the bean’s state. If they are, then they belongs in the bean. If not, then they should be a standalone implementation of any FacesListener interface, but definitely not a managed bean.


    Support Managed-Bean: This type of bean “supports” one or more views in the “View” concern of the MVC design pattern. The typical use case is supplying an ArrayList to JSF h:selectOneMenu drop-down lists that appear in more than one JSF view. If the data in the dropdown lists is particular to the user, then the bean would be kept in session scope.

    Fine. For application wide data like dropdown lists just use an @ApplicationScoped bean and for session wide data like logged-in user and its preferences just use a @SessionScoped one.


    Utility Managed-Bean: This type of bean provides some type of “utility” function to one or more JSF views. A good example of this might be a FileUpload bean that can be reused in multiple web applications.

    This makes not really sense to me. Backing beans are usually tied to single views. This sounds too much like an ActionListener implementation which is to be used by <f:actionListener> in command components to your choice. Definitely not a managed bean.

    For kickoff examples of the right approach, see also:

    • Hello World example in Our JSF wiki page
    • “Bookstore CRUD” example in this answer
    • “Master-detail” example in this answer
    • JSF Service Layer
    • Communication in JSF 2
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ever wonder what wikipedia's database schema looks like? I recently read this thread from
Recently, I read this article: http://download.oracle.com/javase/tutorial/extra/generics/wildcards.html My question is, instead of creating a method
I have recently read the safe bool idiom article. I had seen this technique
I recently read this article . Which uses the Silverlight Bing maps control to
I've recently read an article http://www.ravelrumba.com/blog/static-cookieless-domain/ about Serving Static Content from a Cookieless Domain
Recently I've read this article: http://www.smashingmagazine.com/2009/09/25/svn-strikes-back-a-serious-vulnerability-found/ Developers of many popular sites like apache.org, php.net
I recently read this article Safe Thread Synchronization as I was curious about the
I recently read this article on smart use of ViewState and am particularly interested
I've recently read this article on using printf and scanf in assembly: Meaning of
Recently I read this Wikipedia article regarding the Dining Philosophers problem but I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.