You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2008/02/05 21:31:11 UTC

[Myfaces Wiki] Update of "JSF and MVC" by SimonKitching

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by SimonKitching:
http://wiki.apache.org/myfaces/JSF_and_MVC

New page:
Over the last decade or so, the development of applications with graphical user interfaces has pretty much standardised. Whether you are developing with Gnome, KDE, MFC, !VisualBasic, Delphi, or any similar library the process is the same:
 * a tree of widgets is built, either by code or by loading a configuration file
 * callbacks are attached to the widgets
 * the GUI framework is left to render and manage the user interface.

When the user activates a widget (clicks a button, chooses a menu option, etc) the appropriate callback is invoked. This callback inspects the requested action, and may choose to report an error, or to update some kind of data-structure according to the user input. Then control is either returned to the UI framework with the same set of widgets, or a new set of widgets (a new "screen" is built).

The data-structure here is the "model"; it may be a model of a building, of an economy, of a text-document, etc. The logic which decides whether to update the model or report an error, and whether to redisplay the same set of widgets (same screen) or a different set (new screen) is the "controller". And the widgets themselves (which may have custom drawing logic) are the "view".

This approach has been vastly successful in systems where all the processing is on one physical computer system. However in our internet-connected world, accessing remote systems in interactive ways is becoming more and more common. Having to deploy applications onto client systems is becoming more and more clumsy.

One solution is the Java !WebStart approach, where client logic is dynamically downloaded. The client can then be implemented much like a traditional MVC application, with the addition of communication back to the original host. However downloading logic to the client computer is not generally popular; it requires significant computer power and memory on the client side, and a large startup delay as the logic is transferred.

JSF instead is a different way to bring the sucessful MVC programming approach to the internet. It is designed to assume that the client has some software capable of rendering a reasonable range of graphical widgets, and of transmitting information back to the server about changes in the state of those widgets. JSF does not assume, however, that it can download any kind of logic to the remote system other than a basic description of the screen layout. Of course there is a widely-spread application that fits the description of a JSF client perfectly: the Web Browser.

Like the previous MVC frameworks (Gnome, KDE, MFC, etc) JSF is based around defining a tree of widgets ("components" in JSF terminology), where some of these components have callbacks associated with them. JSF ensures that when data is received back from the remote client the appropriate callbacks are invoked, without (in most cases) user code having to deal with things like HTML forms or urls. Instead, controller code simply responds to events, updates data-models, and then builds an appropriate view to render the new application state.

In practice, JSF component trees (widget trees) are almost always defined via a "template file", and the most popular template file formats happen to be JSP and XHTML files. Purists will limit themselves to defining only widgets in such files, but many people also take the opportunity to encode fragments of traditional HTML or XHTML in such files, and JSF implementations traditionally merge the two to generate the output that is actually sent to the remote client.

You will of course have noticed that while the effect is similar to older web-application frameworks like Apache Struts, the approach is somewhat different. The HTML and Web are abstracted away to a great extent. This allows a number of nice features, like being able to simply change configuration to render HTML, XHTML, WML, and potentially things like PDF or Mozilla-XUL.

One of the issues that people notice when moving from more html-centric frameworks to JSF is that there is some loss of control over exactly what urls are generated, what appears in the query parameters, etc. Part of this is due to handling over of control of these aspects to a framework rather than directly managing it; other parts are due to the fact that JSF is still a reasonably young technology and still has a few rough edges. And partly it is due to the fact that JSF is optimised for very interactive applications; it can do things that are extremely complex to do with other approaches, but does not always perform quite as elegantly in the simpler cases.

Re: [Myfaces Wiki] Update of "JSF and MVC" by SimonKitching

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> I don't think this will be controversial - I find it a rather good
> basic introduction to the concepts behind JSF, actually.
I too think that this is a good introduction for any newbie. Something
you'll normally read in a book but now public for everyone.

Ciao,
Mario

>
> regards,
>
> Martin
>
> On Wed, Feb 6, 2008 at 12:03 AM, Matthias Wessendorf
> <matzew@apache.org <ma...@apache.org>> wrote:
>
>     haha :)
>
>     On Feb 5, 2008 10:37 PM, Andrew Robinson
>     <andrew.rw.robinson@gmail.com
>     <ma...@gmail.com>> wrote:
>     > I was wondering what the purpose was. It seemed to me like the
>     apache wiki
>     > was going to start turning into a personal blog site :)
>     >
>     >
>     >
>     > On Feb 5, 2008 1:34 PM, simon <simon.kitching@chello.at
>     <ma...@chello.at>> wrote:
>     >
>     > >
>     > >
>     > > On Tue, 2008-02-05 at 20:31 +0000, Apache Wiki wrote:
>     > > > Dear Wiki user,
>     > > >
>     > > > You have subscribed to a wiki page or wiki category on
>     "Myfaces Wiki"
>     > for change notification.
>     > > >
>     > > > The following page has been changed by SimonKitching:
>     > > > http://wiki.apache.org/myfaces/JSF_and_MVC
>     > >
>     > > I expect this page will be a little controversial :-)
>     > >
>     > > The main goal was to address the "why doesn't it work like
>     > > struts/webwork" questions.
>     > >
>     > > But feel free to modify any bits that you don't agree with..
>     > >
>     > > Regards,
>     > > Simon
>     > >
>     > >
>     > >
>     >
>     >
>
>
>
>     --
>     Matthias Wessendorf
>
>     further stuff:
>     blog: http://matthiaswessendorf.wordpress.com/
>     sessions: http://www.slideshare.net/mwessendorf
>     mail: matzew-at-apache-dot-org
>
>
>
>
> -- 
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces 


-- 
mit freundlichen Grüßen

Mario Ivankovits
Software Engineering

OPS EDV VertriebsgesmbH
A-1120 Wien, Michael-Bernhard-Gasse 10

Firmenbuch Nr.: FN51233v, Handelsgericht Wien
Tel.: +43-1-8938810; Fax: +43-1-8938810/3700
http://www.ops.co.at

E-Mail: mario@ops.co.at
Skype: mario_ivankovits


Re: [Myfaces Wiki] Update of "JSF and MVC" by SimonKitching

Posted by Martin Marinschek <ma...@gmail.com>.
I don't think this will be controversial - I find it a rather good basic
introduction to the concepts behind JSF, actually.

regards,

Martin

On Wed, Feb 6, 2008 at 12:03 AM, Matthias Wessendorf <ma...@apache.org>
wrote:

> haha :)
>
> On Feb 5, 2008 10:37 PM, Andrew Robinson <an...@gmail.com>
> wrote:
> > I was wondering what the purpose was. It seemed to me like the apache
> wiki
> > was going to start turning into a personal blog site :)
> >
> >
> >
> > On Feb 5, 2008 1:34 PM, simon <si...@chello.at> wrote:
> >
> > >
> > >
> > > On Tue, 2008-02-05 at 20:31 +0000, Apache Wiki wrote:
> > > > Dear Wiki user,
> > > >
> > > > You have subscribed to a wiki page or wiki category on "Myfaces
> Wiki"
> > for change notification.
> > > >
> > > > The following page has been changed by SimonKitching:
> > > > http://wiki.apache.org/myfaces/JSF_and_MVC
> > >
> > > I expect this page will be a little controversial :-)
> > >
> > > The main goal was to address the "why doesn't it work like
> > > struts/webwork" questions.
> > >
> > > But feel free to modify any bits that you don't agree with..
> > >
> > > Regards,
> > > Simon
> > >
> > >
> > >
> >
> >
>
>
>
> --
> Matthias Wessendorf
>
> further stuff:
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> mail: matzew-at-apache-dot-org
>



-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: [Myfaces Wiki] Update of "JSF and MVC" by SimonKitching

Posted by Matthias Wessendorf <ma...@apache.org>.
haha :)

On Feb 5, 2008 10:37 PM, Andrew Robinson <an...@gmail.com> wrote:
> I was wondering what the purpose was. It seemed to me like the apache wiki
> was going to start turning into a personal blog site :)
>
>
>
> On Feb 5, 2008 1:34 PM, simon <si...@chello.at> wrote:
>
> >
> >
> > On Tue, 2008-02-05 at 20:31 +0000, Apache Wiki wrote:
> > > Dear Wiki user,
> > >
> > > You have subscribed to a wiki page or wiki category on "Myfaces Wiki"
> for change notification.
> > >
> > > The following page has been changed by SimonKitching:
> > > http://wiki.apache.org/myfaces/JSF_and_MVC
> >
> > I expect this page will be a little controversial :-)
> >
> > The main goal was to address the "why doesn't it work like
> > struts/webwork" questions.
> >
> > But feel free to modify any bits that you don't agree with..
> >
> > Regards,
> > Simon
> >
> >
> >
>
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Re: [Myfaces Wiki] Update of "JSF and MVC" by SimonKitching

Posted by Andrew Robinson <an...@gmail.com>.
I was wondering what the purpose was. It seemed to me like the apache wiki
was going to start turning into a personal blog site :)

On Feb 5, 2008 1:34 PM, simon <si...@chello.at> wrote:

>
> On Tue, 2008-02-05 at 20:31 +0000, Apache Wiki wrote:
> > Dear Wiki user,
> >
> > You have subscribed to a wiki page or wiki category on "Myfaces Wiki"
> for change notification.
> >
> > The following page has been changed by SimonKitching:
> > http://wiki.apache.org/myfaces/JSF_and_MVC
>
> I expect this page will be a little controversial :-)
>
> The main goal was to address the "why doesn't it work like
> struts/webwork" questions.
>
> But feel free to modify any bits that you don't agree with..
>
> Regards,
> Simon
>
>
>

Re: [Myfaces Wiki] Update of "JSF and MVC" by SimonKitching

Posted by simon <si...@chello.at>.
On Tue, 2008-02-05 at 20:31 +0000, Apache Wiki wrote:
> Dear Wiki user,
> 
> You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
> 
> The following page has been changed by SimonKitching:
> http://wiki.apache.org/myfaces/JSF_and_MVC

I expect this page will be a little controversial :-)

The main goal was to address the "why doesn't it work like
struts/webwork" questions. 

But feel free to modify any bits that you don't agree with..

Regards,
Simon