This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line! See this thread for details.
Pros: �Struts have been around for a few years and have the edge on maturity. And since it here from many years there are many developers who know struts very well.
�It is one of the first MVC framework, and hence very cumbersome and "backward" by today's standards (because of the need to maintain backward compatibility, they can't rearchitect it the way it should be done).
�The heart of Struts is the Controller. Struts use the Front Controller Pattern and Command Pattern. A single servlet takes a request, translates HTTP parameters into a Java ActionForm, and passes the ActionForm into a Struts Action class, which is a command. The URI denotes which Action class to go to. The Struts framework has one single event handler for the HTTP request. Once the request is met, the Action returns the result back to the front controller, which then uses it to choose where to navigate next. This structure restricts struts to handle only one event per request.
�Struts were designed to be model neutral, so there are no special hooks into a model layer. There are a view reflection-based copy utilities, but that's it. Usually, page data must be moved from an Action Form into another Model input format and requires manual coding. The Action Form class provides an extra layer of tedious coding and state transition.
�It designed to be mode neutral, so there are no special hooks into struts. Page data must be moved from an Action Form into another Model input format and requires manual coding. The ActionForm class, provides an extra layer of tedious coding and state transition
�Struts1.x+webwork2 = Struts2.x
�It provides some goodies like
oStateful Checkboxes oFirst class AJAX support oEasy integration with Spring Framework oNo More Actions Forms, use POJO forms oEasy to Customize Controller oEasy Plugins etc. etc. oStateful Checkboxes oFirst class AJAX support oEasy integration with Spring Framework oNo More Actions Forms, use POJO forms oEasy to Customize Controller oEasy Plugins etc. etc.
� The major change in Struts 2 might be learning curve for developers. � You can find more detail information on Struts2 site.
�JSF is an official standard from sun. It is a Specification, hence will have lots of implementations. It is also now part of the J2EE specs. Therefore any vendor that wants to be J2EE compliant is forced to come out with a JSF implementation and provide support for it.
�JSF has been designed from the ground up to support Portlets (JSR 168). It just fits into the portal. It is almost like a container agnostic framework. You can write JSF for standard web development and then turn around and put it into a portlet with little if any change.
�JSF was built with a component model in mind to allow tool developers to support RAD development. JSF provides the ability to build components from variety of view technologies like Rational Software Developer etc.
�JSF uses the Page Controller Pattern. Although there is a single servlet every faces request goes through, the job of the servlet is to receive a faces page with components. It will then fire off events for each component and render the components using a render toolkit. The components can also be bound to data from the model. Thus JSF can have several event handlers on a page and can be hooked into model without breaking model, In short, JSF adds many benefits of FrontController but at the same time gives flexibility of Page Controller.
�The new portlet specification JSR286 as opposed to JSR -168, speaks quite a bit on the topic of JSF support. It's just an added bit of confidence that the JSF portlet apps we write now will be very portable in future portal applications servers.
�IBM is a pioneer in portlet technology and although they heavily supported struts in their portal, their portal team strongly recommends using JSF instead of struts.
�Using JSTL in JSF produces un-specified results. It works sometimes and does not work some times.
�There is no apparent support for Portlet Modes or Preferences.
Does Spring Satisfy Needs?
�Spring itself is more than a MVC framework. Spring is made up of many components, main component being the Core Container (Beans, BeanFactory, ApplicationContext, etc) that provide the Dependency injection via a lightweight container, and the rest of the components (e.g. AOP, Transaction Management, etc. ) are built around it.
�The idea is that Spring allows you to use what ever you want, to mix and match its components easily. So in effect, you can use Spring to do your Transaction Management and AOP but choose to use Spring MVC, Struts or JSF as your MVC framework.
�Spring MVC is again action oriented framework like Struts and unlike JSF and Tapestry.
�There is a Spring Portlet Framework available now, which is gaining industry acceptance.
Can we think of Tapestry?
�Tapestry is a innovative and since it is complicated to use. It has a steep learning curve.
�It has same model like JSF so it can�t compete with JSF. But here is a very good discussion of using one over another.
�In general, unless there is a compelling need, direct use of portlet API is recommended instead of using any framework. For less complicated portlets can also give a thought of using tools like IBM portlet factory. �As till today there is no specific portlet framework available, till then a long-term strategy would be to move to JSF as other then all the pros following information also forces to use JSF.
oJSF has Specification. oIt is integrated in JEE 5
�At first glance Struts 2 looks promising, but yet not proved as being very new and developers are readily not available.
[ October 03, 2007: Message edited by: Jignesh Patel ] [ February 06, 2008: Message edited by: Bear Bibeault ]
Well said. Don't be surprised if you find that whole post plagarized and placed at the back of the next edition of my portlet programming book.
There are no 'right frameworks.' There are only 'wrong frameworks.' The best we can do is not use the wrong framework.
One thing that can't be debated is the fact that JSF is being tightly integrated into the next specification, JSR-286. Plus, Sun is heavily behind JSF, and IBM has seemed to put more stress on JSF portlets, as opposed to Struts portlets, which they really pushed heavily in WPS 5.0.
Bigger portlet apps, I like JSF. Really big ones, do the heart with Spring. For the simple and straight forward stuff, the JSR-168 API is often the way to go.
I found your post more informative. Thanks for that. Could you please also throw some light on how did you use struts 2 app as portlets. If you have found some portlet bridge for struts 2 could you please point us to the same.