Model-View-Presenter example with JSF implementing the view ?
Does anyone know of a code example application illustrating how to implement the pattern Model-View-Presenter with at least JSF as one view (and for example Swing as another view which is reusing the same Presenter) ?
(
Model-View-Presenter:
http://msdn.microsoft.com/msdnmag/issues/06/08/DesignPatterns/
)
[337 byte] By [
TomJoa] at [2007-11-27 8:03:59]

# 1
The problem is that in JSF the presenter rarely calls methods in the view, normally the view calls properties and methods in the controller (through binding).
I have privately written my own pattern document for JSF and MVC and the pattern that fits JSF best is called the passive MVC pattern (fowler) which is a variation of presenter. Personally too many people using JSF and DI think that binding to the model is ok from the view and I think this pattern causes many issues.
Examples, I rarely see any because almost all examples bind directly to the model. I allow binding to the model only through the presenter. For example "#{presenter.model.property} in those cases where setters/getters are ok into the model. Note in this case that the presenter owns the model instance.
I call my presenter a ViewController and think is is very similar to a use-case controller. Fowler talks about Supervisinig Presenter http://www.martinfowler.com/eaaDev/SupervisingPresenter.html which I think best suits JSF programming style.