On 1/7/06, Mark Lowe <[EMAIL PROTECTED]> wrote:
>
> On 1/7/06, Dakota Jack <[EMAIL PROTECTED]> wrote:
> > JSF is page centric rather than Action centric.  There is no controller
> as
> > you understand that in Struts with JSF.  JSF is for a tool based, dumbed
> > down, approach: JSF is to Struts as Visual Basic is to C++.
>
> JSF is more page centric than struts, but they aren't chalk and
> cheese. The view controller is still in the backing bean and then
> mapping of outcome to jsp is done via xml configuration. How page or
> controller centric you want jsf to be is upto you, this is where the
> diffence between JSF being a spec and struts a framework start being
> more visible.


If you are familiar with Core J2EE Patterns terminology, you'll find it
easiest to understand JSF and Shale in terms of the View Helper[1] pattern,
where the helper items are the JSF component tags and your backing beans,
and the Dispatcher View[2] pattern, which combines the Front Controller[3]
and View Helper[1] patterns together.  In the Dispatcher View sequence
diagram (Figure 7.25) the roles and responsibilities match up like this:

* Contrroller == FacesServlet

* Dispatcher == the JSF Lifecycle object that manages the request processing
lifecycle

* View == The JSF view (often a JSP page, but not required with things like
Clay or Facelets)

* Helper == The backing bean assocated with the view (in Shale, the
VIewController is a View Helper
  that does more than what you get in pure JSF applications)

In a JSF application, there's actually two ways to implement classic Front
Controller type functionality, such as "send the user to the logon page if
they are not currently logged on":

* With a servlet Filter that gets invoked in front of the JSF controller
(Shale has support for this).  When
  Struts 1.0 was created, there was no such thing, so we had to provide this
capability inside ActionServlet.
  Now, the container has a much more flexible mechanism that can work on
either JSF requests or
  non-JSF requests.

* By using a JSF PhaseListener to interact with the JSF Lifecycle (which has
Controller capabilities as well)
  This is the way most AJAX enabled JSF components interact with the server
side of their asynchronous
  requests ... they submit a request to a URL mapped to FacesServlet, and a
component-provided
  PhaseListener intercepts control after the Restore View phase has
completed.  But the point is clear ...
  the Lifecycle implementation plays a controller role as well, and you can
customize its behavior with
  phase listeners quite easily.


If I was asking how to get started with jsf and shale I'd find your VB
> vs C++ statement confusing and not very helpful at all.


Don't expect much help from someone who doesn't seem to care much for either
JSF or Shale :-).

Mark


Craig

[1] http://java.sun.com/blueprints/corej2eepatterns/Patterns/ViewHelper.html
[2]
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DispatcherView.html
[3]
http://java.sun.com/blueprints/corej2eepatterns/Patterns/FrontController.html

Reply via email to