Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Part II - ViewHelper pattern

 
Marcelo Ortega
Ranch Hand
Posts: 528
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it fair to say that for the ViewHelper pattern, the JSF pages are the views and the ManagedBeans are the helpers? I'd say so but any clarification on this would be appreciated.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that is fair. It's more MVC than ViewHelper, but your logic is sound.
 
Rajan Choudhary
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marcelo Ortega wrote:Is it fair to say that for the ViewHelper pattern, the JSF pages are the views and the ManagedBeans are the helpers? I'd say so but any clarification on this would be appreciated.


well, I do not consider managed bean as helper of the view. Managed beans are models where business logic is processed. Managed bean just tells the controller about the next destination of the flow. I would consider any component which is helping to the view in rendering some or part of the page. like, you might want to have a formatter which formats the data in specific way. You might want to use some custom tags in JSP, those are helpers. A resource bundle which loads the language specific resources and displays the label, is also an helper for the view.

Again, one could argue that managed bean provides data for jsp to display but that's the basic principal of MVC and I don't consider backing bean a helper because it provides data.
 
guru prasanth
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To add more to that in JSF it's converters and validators which act as kinds of helpers than managed beans.So you can say converters,validators and managed bean together will do little more than ViewHelper.
 
Rajan Choudhary
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Absolutely, all convertors, validations, formatters, listeners (which act on page load) are view helpers.
 
John Lincoln
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But remember, in JSF jsp and managed bean go together. I mean it is a whole relationship (i.e one cannot exits without other).

Managed bean provides the data to the jsp (data-binding), but i am not sure it is the model (unless you make calls directly to get data instead of a delegate). You might get your data form database or webservice or some other way.

Just my 2 cents. Please correct me if my understanding is wrong

thank you

 
Rajan Choudhary
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moreover, the best example of ViewHelper in JSF world is to use customized page rendering components. Meaning you could have your own wrapper over the JSF standard components to change the behavior, look and feel of components etc.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic