wood burning stoves 2.0*
The moose likes JSF and the fly likes JSF vs Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF vs Struts" Watch "JSF vs Struts" New topic
Author

JSF vs Struts

Muks Sam
Ranch Hand

Joined: Apr 09, 2004
Posts: 47

While Going through JSF stuff, i got to know JSF is more complex and there some pit falls also. So considering those pit falls and complications, What makes JSF a great tech. to land.

Thanks

Mukuk
Chris Schalk
author
Ranch Hand

Joined: Aug 31, 2006
Posts: 62
I'm not sure I'd agree that Faces is more complex - meaning harder to use in all cases. Building very basic Faces apps is very trivial and on par and perhaps even easier than Struts.

I would say that Faces is more sophisticated though. This is due to the fact that it provides more technology with its UI component model. This is where the power of Faces can be observed especially when you look at the growing collection of powerful Faces components that are being offered such as MyFaces (Tomahawk, Trinidad ..) as well as WebGalileo, ESRI, Sun's Studio components etc..

-Chris
Muks Sam
Ranch Hand

Joined: Apr 09, 2004
Posts: 47

Thanks Chris for explanation.
Juhan Voolaid
Ranch Hand

Joined: Nov 18, 2003
Posts: 179
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
 
 
subject: JSF vs Struts
 
Similar Threads
This weeks book Giveaway:
correct method for reading code
Help me out, PLEASE!
Ball Physics implementation.
Passed SCJP with 98%