Moaning about Struts 1 won't help you move to Struts 2

(Struts is one of the most popular way for companies to build their websites. This was to be posted on Bill moaning about Struts 1 problems, but Bill’s blog isn’t accepting comments at the moment.)

Struts 2 Logo

Bill,

I hate to spoil your Struts 1 party , but most of these problems have been known for some time (and the Struts team would be the first to articulate them). Struts 2 is a huge improvement and , as you mention, there are good alternatives out there (including Spring MVC).

The problem is that migration from Struts 1 to (for example) Struts 2 , while easy, still carries a risk for the project in question. It can be hard to convince the business decision maker when all they see is pain (‘so you’re going to break the existing site?‘) for very little gain (‘where’s the immediate payback of upgrading?‘).

My advice is to stick with Struts 1 on existing projects. Use Struts 2 (or even better, Appfuse) on new projects. And for new code on existing projects, consider running them both side by side. They’re all tried and tested solutions.

Paul

5 Comments

  1. It should be possible to migrate in a piecemeal fashion. If the decision has been made that the current technology is sub-standard relative to the state-of-the-art it should be possible to mandate that new development be done with Struts 2, Spring MVC or whatever other technology (but please God, no JSF!) without rendering the legacy portion of the app obsolete (all that needs to happen is the front controller of the new framework respond to requests on a different uri pattern, and both can live side by side for a time). The influence of the old framework can be steadily reduced over time before being removed altogether from the mix…

  2. John,

    That’s pretty much what the Struts 1/ Struts 2 guys say as well 🙂

    Can’t remember the URL, but they give a good , worked through, example on their site.

    Paul

  3. Bill,

    The ‘moaning’ thing came across more harshly than I intended 🙂

    I don’t thing Struts 2 is *the* answer, I do think it is a big improvement. To use the bullet points from your original post:

    * Verbosity: Better but not perfect. Fewer classes needed, more of them POJO and sensible defaults in the config file.

    * Url pattern mapping: Slightly better, if this is a must have , then I’d recommend Spring MVC which is much more power in this area.

    * Struts(-config).xml: Better , still suffering for the ‘one place to do config’ – easy to know where to find stuff. Can use includes to split the file if require.

    * Not so difficult to test. Struts 2 is pretty much plain Java all the way – a lot easier to (J)unit test. My single biggest reason to make the move.

    * Template support: Agree with you here. Use Sitemesh. Even better, use sitemesh pre configured with Struts2 (using Maven and Appfuse)

    * MVC v the Web in general: I suppose it depends on the way that you think. Not matter what your point of view, At least Struts (2) isn’t as bad as JSF.

    The underlying the bulk of my comment post: All these are reasons to move from Struts 1 (to framework of your choice). Convincing business users isn’t going to be as easy.

    Paul

  4. Struts 1.x is the most aweful, confusing
    and ridiculuously difficult technology
    the programming world might have
    ever seen. no wonder its mention
    can be found here :

    http://www.manageability.org/blog/stuff/most-valuable-personalities-in-java
    (Hats off to the author of this article)

    what is more pathetic to find is that
    there are some people who are for
    whatever (personal) reasons are
    promoting this technology.

    2 cents advise is to use Struts 2, JSF,
    Stripes instead of putting thankless
    effort and wasting time in the trench.

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