aspose file tools*
The moose likes JSF and the fly likes Struts vs JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Struts vs JSF" Watch "Struts vs JSF" New topic
Author

Struts vs JSF

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi All,

I have found the following differences between both of them. Can someone please correct me if I am wrong?


Advantage of struts over JSF:

1).Struts is controller based and provides access to the controller.
2).Struts has tiles framework
3).More documentation or support is available online because it's an old framework compared to it's counterpart.

Advantages of JSF over struts:
1). JSF is component/view based. It provides many UI components for better UI web applications
2). Jsf application works fine on mobile phones too coz it can render to WML clients where as struts can only render to html clients.
3).Less complexity. No need to bother about all the ActionForms and ActionClasses.

Thanks.
[ December 27, 2008: Message edited by: Arjun Reddy ]

Be Humble... Be Nice.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Advantage of struts over JSF:

1). Probably not. JSF has more canned controller functionality, however, so you don't need to write as much controller code.
2). I think Tiles now works with JSF, but as I mentioned in an earlier post, I prefer Facelets to do my tiling with. They look a lot alike, however.
3). Probably not, at this late date.

Advantages of JSF over struts:
1). Yup. Actually, it's as about close to true MVC as HTTP can permit.
2). Not true. I've used Struts to render up PDF's, XML and other stuff. There is even a framework for Struts that lets you select a renderer based on the client, although it's not part of basic Struts. It's actually easier in some ways to switch renderers on Struts, since you have to manually control them.
3). Fewer source files, anyway.


Customer surveys are for companies who didn't pay proper attention to begin with.
Pankaj Misra
Greenhorn

Joined: Dec 28, 2008
Posts: 11
I 100% agree with Tim.

Some of the other differences that can be discussed about
1. JSF is JSR-127, hence can be taken as one of the web frameworks which will be supported by all the J2EE containers

2. Though Converters can be implemented in any of the web frameworks, JSF provides many out of the box converters and interfaces to build custom converters and validators

3. Dynamic inclusion/exclusion of converters/validators and managed beans.

4. Flexibility to make custom components that can be re-used across pages.

5. Internal working of JSF is far more complex, and phase driven, In order to properly understand JSF in-and-out, one needs to understand its elaborate life cycle phases.

6. Not all navigations are simple with JSF, think about a drop down based navigation...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts vs JSF