Copy-paste from:
http://courses.coreservlets.com/ -- Hands-on, customized training for
Java,
servlets,
JSP, Struts, and JSF.
Advantages of JSF (vs. Struts):
Custom components
� JSF makes it relatively easy to combine complex GUIs
into a single manageable component; Struts does not
� Support for other display technologies
� JSF is not limited to HTML and HTTP; Struts is
� Access to beans by name
� JSF lets you assign names to beans, then you refer to
them by name in the forms. Struts has a complex process
with several levels of indirection where you have to
remember which form is the input for which action.
� Expression language
� The JSF expression language is more concise and
powerful than the Struts bean:write tag.
� This is less advantageous if using JSP 2.0 anyhow.
Simpler controller and bean definitions
� JSF does not require your controller and bean classes to
extend any particular parent class (e.g., Action) or use
any particular method (e.g., execute). Struts does.
� Simpler config file and overall structure
� The faces-config.xml file is much easier to use than is the
struts-config.xml file. In general, JSF is simpler.
� More powerful potential tool support
� The orientation around GUI controls and their handlers
opens possibility of simple to use, drag-and-drop IDEs
Disadvantages of JSF (vs. Struts):
Established base and industry momentum
� Struts has a large core of existing developers and momentum among
both developers and IT managers; JSF does not.
� Support for other display technologies
� JSF is not limited to HTML and HTTP; Struts is
� Hey! Didn't I say this was an advantage of JSF?
� Confusion vs. file names
� The actual pages used in JSF end in .jsp. But the URLs used end in
.faces or .jsf. This causes many problems; in particular, in JSF
� You cannot browse directories and click on links
� It is hard to protect raw JSP pages from access
� It is hard to refer to non-faces pages in faces-config.xml
� Self-submit approach
� With Struts, the form (blah.jsp) and the handler (blah.do) have
different URLs; with JSF they are the same. Many developers find
this clumsy.
Less current tool support
� Struts is supported by many widely used IDEs; JSF is not (yet)
� No equivalent to Tiles
� Struts comes with a powerful page layout facility; JSF does not
� But you can extract Tiles from Struts and use it with JSF
� Much weaker automatic validation
� Struts comes with validators for email address, credit card numbers,
regular expressions, and more. JSF only comes with validators for
missing values, length of input, and numbers in a given range.
� But MyFaces has several powerful validators
� Lack of client-side validation
� Struts supports JavaScript-based form-field validation; JSF does not
� Worse installation
� JSF does not have equivalent of struts-blank to start with
� POST only
� JSF does not support GET, so you cannot bookmark results pages
JSF and Struts: The Future:
Possibilities
� JSF will fail and developers that want a framework will
stick with Struts
� JSF will die
� Not impossible, since other MVC frameworks have failed already
� JSF will flourish and replace Struts
� Struts will die
� JSF will grow moderately, and developers will be split
� Both Struts and JSF will be widely used frameworks
� Prediction is difficult
� Technical factors are not usually what decide these things
� Recommendations
� Migrate ongoing Struts projects to JSF: not yet
� Start real-world JSF projects: yes, but with some caution