JSF x Struts x STRUTS2

4 respostas
J

Tai,

:?:Por que falam que JSF é melhor que Struts?
:?:Struts 2 é melhor que JSF?

Valeu mesmo :!:

4 Respostas

nextuser

depende muito do skill, experiencia, e muito gosto!! - cada um tem o teu né?

eu gosto de Struts2 que é o antigo webwork, mas olha ai!!

JSF
Pros:
Java EE Standard - lots of demand and jobs
Fast and easy to develop with initially
Lots of component libraries
Cons:
Tag soup for JSPs
Doesn’t play well with REST or Security
No single source for implementation

Spring MVC
Pros:
Lifecyle for overriding binding, validation, etc.
Integrates with many view options seamlessly:
JSP/JSTL, Tiles, Velocity, FreeMarker, Excel, PDF
Inversion of Control makes it easy to test
Cons:
Configuration intensive - lots of XML
Almost too flexible - no common parent Controller
No built-in Ajax support

Stripes
Pros:
No XML - Convention over Configuration
Good documentation (easy to learn)
Enthusiastic community
Cons:
Small Community
Not as actively developed as other projects
Hard-coded URLs in ActionBeans

Struts 2
Pros:
Simple architecture - easy to extend
Tag Library is easy to customize with
FreeMarker or Velocity
Controller-based or page-based navigation
Cons:
Documentation is poorly organized
No feedback for missing properties or invalid OGNL expressions
Googling results in Struts 1.x documentation

Tapestry
Pros:
Very productive once you learn it
Templates are HTML - great for designers
Lots of innovation between releases
Cons:
Documentation very conceptual, rather than pragmatic
Steep learning curve
Long release cycles - major upgrades every year

Wicket
Pros:
Great for Java developers, not web developers
Tight binding between pages and views
Active community - support from the creators
Cons:
HTML templates live next to Java code
Need to have a good grasp of OO
The Wicket Way - everything done in Java

Evaluation Criteria
Ajax Support: Is it built-in and easy to use?
Bookmark-ability: Can users bookmark pages and return to them easily?
Validation: How easy is it to use and does it support client-side (JavaScript) validation?
Testability: How easy is it to test Controllers out of container?
Post and Redirect: How does the framework handle the duplicate post problem?
Internationalization: How is i18n supported and how easy is it to get messages in Controllers?
Page Decoration: What sort of page decoration/composition mechanisms does the framework support?
Community and Support: Can you get questions answered quickly (and respectfully)?
Tools: Is there good tool (particularly IDE) support for the framework?
Marketability of Skills: If you learn the framework, will it help you get a job?

Ajax Support
Is Ajax support built-in and easy to use?
JSF: No Ajax support, use ICEfaces and Ajax4JSF
Stripes: No libraries, supports streaming results
Struts 2: Dojo built-in, plugins for GWT, JSON
Spring MVC: No libraries, use DWR & Spring MVC Extras
Tapestry: Dojo built-in in 4.1
Wicket: Dojo and Script.aculo.us (Wicket Stuff)

Bookmarking and URLs
JSF does a POST for everything - URLs not even considered
Stripes uses conventions, but you can override
Struts 2 has namespaces - makes it easy
Spring MVC allows full URL control
Tapestry still has somewhat ugly URLs
Wicket allows pages/URLs to be mounted

Validation
JSF has ugly default messages, but easiest to configure
Spring MVC allows you to use Commons Validator - a mature solution
Struts 2 uses OGNL for powerful expressions - client-side only works when specifying rules on Actions
Tapestry has very robust validation - good messages without need to customize
Stripes and Wicket do validation in Java - no clientside

Testability
Spring and Struts 2 allow easy testing with mocks (e.g. EasyMock, jMock, Spring Mocks)
Tapestry appears difficult to test because page classes are abstract, Creator class simplifies
JSF page classes can be easily tested and actually look a lot like Struts 2 actions
Wicket has WicketTester, a powerful solution
Stripes has Servlet API Mocks and MockRoundtrip

Post and Redirect
The duplicate-post problem: redirect after POST
Is there support for allowing success messages to live through a redirect?
Spring MVC allows you to add parameters to a redirect
Stripes, Tapestry and Wicket all have “flash” support
Struts 2 requires a custom solution
JSF requires a custom solution, i18n messages difficult to get in page beans

Internationalization
JSTL?s fmt:message tag makes it easy
No standard for getting i18n messages in controller classes
Stripes, Spring MVC and JSF use a single ResourceBundle per locale
Struts 2, Tapestry and Wicket advocate separate files for each page/action
JSF requires resource bundle to be declared on each page
Tapestry’s is awesome

Page Decoration
Tiles Experience: used since it first came out
SiteMesh is much easier to setup and use
Tiles can be used in Struts 2, Spring and JSF
Requires configuration for each page
SiteMesh can be used with all frameworks
Requires very little maintenance after setup
SiteMesh not supported or recommended for use with JSF, Tapestry or Wicket

Marketability of Skills
Struts 1 is still in high-demand and widely-used
Spring is getting more press, but mostly due to the framework?s other features
JSF is becoming popular; awful with JSP
Struts 2 is gaining ground, but very scarce on job boards
Tapestry has increased in popularity in last couple years
Wicket and Stripes are virtually unknown

J

Eh, Acho que vou ter de estudar struts 2 mesmo …

Muito boa, valeu mesmo…

Rafael_Carneiro

Veja: http://www.slideshare.net/mraible/comparing-jsf-spring-mvc-stripes-struts-2-tapestry-and-wicket-presentation

nextuser

é isso ai mas eu tirei o lado pessoal da apresentação né!!

Criado 8 de fevereiro de 2009
Ultima resposta 9 de fev. de 2009
Respostas 4
Participantes 3