Skip to main content

Coming home to Struts (after life in the land of JSF)

Posted by dsuspense on August 20, 2006 at 6:48 AM PDT

I am currently on a Struts contract, after working on a JSF (MyFaces) project for the past year. So what is it like moving back?

The first hurdle is coming up to speed with the changes since Struts 1.0, which was the last Struts version I used almost 3 years ago. Tiles, Validator, Modules, Plugins, JSTL support, Spring support, Hibernate support, IBatis support and numerous Action and Form classes to extend and customize are some of the changes that make Struts more of a joy to work with now.

Working with JSF (MyFaces) on the other hand, while suporting many of the new opensource Java projects that make web application development easier today (Spring, Hibernate, Ibatis, etc), felt like Struts 1.0 did back in those days.
Lack of formal documentation, limited resources for finding examples and "recipes" were the things that increased the JSF learning curve.
Luckily the MyFaces mailing lists were a well populated source of code samples tips for overcoming the implementation limitations that existed at the time.

So how does "programming" in Struts compare to JSF?
Struts just feels more like programming for the web, than does JSF.
This of course makes perfect sense since JSF is a component/event oriented approach, and Struts is an action oriented approach.
However, the web applications are increasingly becoming component/event oriented as AJAX is becoming a key ingredient in web applications today.
Both Struts and JSF are incorporate AJAX techniques, which is a good thing going forward.

What can you do if you are interested on embarking on a Java web app project and need to decide what to use?
My recommendation would be to download a project like AppFuse and code some samples using both web frameworks and see which one you like best. Matt Raible and company have done a great job growing the AppFuse project and making it the best Java starter web app toolkit around.

If you are looking for more information comparing Struts and JSF I would recommend the following articles/blogs:

JavaServer Faces (JSF) vs Struts
Struts vs. JavaServer Faces
Ajax using XMLHttpRequest and Struts
Sprinkle Some AJAX Magic in Your Struts Web Application
Using JavaServer Faces Technology with AJAX
Adding AJAX to Java with DWR

Related Topics >>