Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF: Are multiple applicationControllers a good programming technique?

 
Ryder James
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry if this is a newbie question, but I didn't know if using more than one applicationController is acceptable.

I have a page that handles inserting and another for editing and deleting rows. I was going to use separate controllers, but I didn't know if it was common practice to run everything through one controller or break things up into more than one.

How does everyone else approach this?

Thanks for the input.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just make sure you don't repeat yourself.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18165
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Ryder?

First of all, I need to make sure of your definitions. If by "multiple applicationControllers", you mean "backing beans", backing beans are not Controllers, they are Models. I'm pointing this out because a depressingly large number of JSF apps I've seen have backing beans whose class names end with "Controller".

Anyway, the answer to that question is that yes, a View can be creating from multiple Models (backing beans), although in order to avoid confusion I recommend some restraint in doing so.

In the literal sense, every MVC system has a master (top-level) Controller that controls all of the subsidiary controllers that bind Model components to View components (web pages, forms, UI controls, etc.). In JSF, that master Controller is the FacesServlet. And There Can Be Only One.

In actuality, you don't do much programming of Controllers in JSF, because the vast majority of the Controllers are pre-written. The master controller is (as I said) the FacesServlet. The component Controllers are part and parcel of the various JSF tag implementations.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic