Struts 2 is the new Mini

No matter what car you drive , the chances are it was influenced by the Mini. Introduced in the UK in the 1960’s a whole generation of families was crammed into a car that popularized the notion of front wheel drive. While small , it was practical and drove so well it even starred in films such as The Italian Job. Recently, a more modern version was released with none of the parts but all of the spirit of the Original.

Mini

We’ll come back to the Mini, but if you build websites using Java, then at some point you have used Struts. The original Struts is proof that a framework / project / product doesn’t have to be the best to be the most widely accepted. It just has to be in the right place at the right time, and ‘do what is says on the tin’ – in this case a fairly useful implementation of the ‘Model-View-Controller’ design pattern.

So what’s the link? Seeing the original Mini from the outside may bring a smile to your face, but on the inside it’s cramped and unfortable. You may have happy memories of websites you built using the original Struts, but lately your thoughts have been straying to more modern frameworks, perhaps with Ajax and integration with Spring built in.

This is where Struts 2 comes in. Like the Mini, it has (almost) none of the parts , but all of the Spirit of the original. It’s based on Webwork which sounds scary, but most Struts Drivers will be able to climb in , find the Struts.xml file and get the engine running within minutes. Struts 2 is easier to drive (JavaBeans instead of Action Forms), more powerful (it can use Ajax and JSF) and comes with more optional extras (e.g. it’s integration with other frameworks like Webwork and Spring).

Best of all the Struts team have a clear migration path between the old and new Struts. You can use both side by side in your garage application, and change over the parts piece by piece. Spare parts for the original Struts will still be available for quite some time, both from the original team and the large dealer developer network that has built up around the framework.

What do you think? When Are you going to give Struts 2 a try?

7 Comments

  1. I really agree with you in the point where you say that when you see back an application with struts you remember the good times, but, there comes the but.

    I have seen a litte bit of webwork and struts 2 but it does not compare to other frameworks like tapestry, struts does not feel like a component oriented framework and it is still invasive in your code, regardless to say that it relies on knowledge and usage of the servlet api (using the api is what really bothers me) i believe that abstracting the servlet api and being non invasive in the html code would really rock, because

    If you have a pretty invasive framework (struts 1, jsf) into your html code with etc etc and do not provide a tool to visualize then i really believe you are going into the wrong road or at least not the optimized one.

    Other frameworks like webwork, spring mvc, jsf have been influenced by struts, but others like tapestry they do not, you can tell when you start working, and asking question: why I have been doing it the wrong way?

    Cheers

  2. Luis; would you be so kind to point out where the ‘invasive’ part of Struts 2 shows ? I can take any POJO and turn it into an Action. Might I suggest another look at Struts 2 ?

    Also, you speak about ‘struts does not feel like a component oriented’ – I assume you mean Struts 2 – well, Struts 2 is an action based framework. Comparing it to Tapestry and Seam is like comparing apples to oranges, wouldn’t you agree ? Struts 2 has some (basic) JSF support (I haven’t tried it) as well.

    I can only assume you are a Tapestry user – well, good on ya, mate ! Be please do not be so blinded as to think Tapestry – or component based frameworks in general – are the way to go for all webbased development.
    Choose the right tool for the job, and believe me when I say I’m certainly as productive in S2 as you will ever be in Tapestry.
    Don’t forget, S2 hasn’t even reached GA yet, do not expect tools/vendor support to just ‘pop up’. You’ll get tool support for S2, you’ll get lots of plugins and goodies, and you’ll see Struts 2 is definitely going to be a strong contender in the Java webapp world.

    My 2 cents.

  3. I built several intranet web applications on Struts over the years, using 1.0 and more recently 1.1

    I eventually become frustrated with Struts, and wound up writing my own MVC web framework (which worked out very well, thanks!)

    Now that Struts 2.x seems to have removed many of the issues that were a concern, I’m giving it a try again.

    I’ve only been working with it for a few days, but it looks good so far.

  4. Rich,

    Just remember that Struts 2 is not Struts 1, but Webwork 3 rebranded.

    Most of the problems that I see Struts people doing the upgrade have involve assuming everything works the same under the hood – it doesn’t. Almost the same, but not quite.

    Paul

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s