wood burning stoves 2.0*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Benefits of using JSF over struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Benefits of using JSF over struts" Watch "Benefits of using JSF over struts" New topic
Author

Benefits of using JSF over struts

kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
Hi All,
What is the benefit of using JSF instead of struts??
Thanks,
kundan


SCJP1.4,SCBCD,SCEA,CNA
Failures are practice shoots for success.
Fintan Conway
Ranch Hand

Joined: Apr 03, 2002
Posts: 141
Originally posted by kundan varma:
Hi All,
What is the benefit of using JSF instead of struts??
Thanks,
kundan


Hi Kundan,

Here is a simple list that I have compiled from various sources on the web:

Struts does not provide the built-in UI component model. And because of that, it does not support UI component event model, nor state management of UI components. Since Struts is more or less tied up with HTML, it does not support the independence between UI components and a particular renderer.
Both JSF and Struts developers implement web pages with JSP custom tags. But Struts tags generate HTML directly, whereas JSF tags represent a component and renderer that generate HTML. That key difference makes it easy to adapt JSF applications to alternative display technologies.
�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.
� In Struts, The ActionForm bean is passed to the Action and the action can do with it what it wants. In JSF, the ValueBinding mechanism exposes the entire managed-bean namespace to anywhere in the app that needs it.
�Expression language
� The JSF expression language is more concise and powerful than the Struts bean:write tag.
�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 jsf-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 the possibility of simple to use, drag-and-drop IDEs.
�Flexibility
� Faces supports a �code behind files� concept, Struts does not.
�Foundation Technologies
� JSF will be in J2EE 1.5
� JSF 1.1 applications can run in a Portlet, Struts applications cannot.
�Components and Events
� Struts has no notion of components. Thus it has no notion of component state. JSF has an excellent state management story supporting saving the state in the client or on the server.
� JSF brings a JavaBeans like event model to the web, Struts has nothing similar to this.
� JSF has dataTable support, struts does not.
� JSF was intended from the beginning to create a market for third party components.
�Conversion and Validation
� Both support type Conversion, but the Faces story is more powerful
� Struts Action class tightly coupled to ActionServlet, can call its methods. Nothing in JSF calls the FacesServlet.

Regards,

Fintan
[ December 22, 2005: Message edited by: Fintan Conway ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Benefits of using JSF over struts
 
Similar Threads
dynamic property in struts
do i really need a shift?
dynamic property in struts
Poll: Do JSF and Struts need their own forums?
is there any ajax based datagrid component around?