struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Schneider <bschnei...@vecna.com>
Subject Re: Theoretical debate
Date Fri, 18 Jun 2004 12:56:54 GMT
> I describe this in more detail in the book, but my take on this is that
> Struts and JSF are focused on different parts of the application. They
> also overlap in some areas, however, which is probably the cause for
> this endless discussion.

In particular, I've noticed that a simple "hello world" application with 
two screens (paint form and respond to POST) looks very similar in JSF 
and Struts, at least on the surface:
- Form beans are "model objects" in JSF
- both Struts and JSF have their own tag library for defining HTML form 
fields.  (at first glance the main advantage of JSF is having validation 
inline with HTML form tags)
- you have FacesServlet instead of ActionServlet
- navigation rules instead of action-forwards
- ApplicationHandlers and EventListeners instead of Actions

JSF has a much more robust component and event handling model, though, 
which makes it more like a "real" GUI framework to work with.  (Struts 
is almost like a base case of JSF, with only one type of event.)  The 
advantage is that JSF is better suited for dealing with more complex UIs 
where you have lots of components with independent state to manage.

Here's one example of something that should be much easier with JSF 
than Struts: Imagine a page with three sortable tables.  When you click 
a header on table #1, the page reloads, re-sorting table #1.  But the 
current sorting on tables #2 and #3 should remain constant.  This is 
obviously possible with Struts, but requires you to futz with URL vars 
somewhere or rely on session scope.  JSF insulates you one layer from 
all that, providing component state management as part of the framework.

The _disadvantage_ to JSF is that when your UI is *simple* (closer to 
hello-world in complexity), JSF seems to be more work to deal with. 
I've found that the insulation from the details of HTTP/request-response 
makes doing simple things much more difficult, while Struts is more 
gentle-slope.  You don't have to use Tiles and Validator right away, and 
there's an obvious, easy path to migrate an ad-hoc/Model 1 servlet or 
JSP to Struts.

-- Bill
-- 
Bill Schneider
Chief Architect

Vecna Technologies, Inc.
5004 Lehigh Road, Suite B
College Park, MD 20740
bschneider@vecna.com
t: 301-864-7594
f: 301-699-3180

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message