Blogbody Rotating Header Image

WebWork Doc-a-Day; Struts Really Sucks

With the upcoming release of WebWork 2.0 beta 2 (just waiting for Ognl 2.6.4 to be released), I’m going to begin a document-a-day effort on my blog. Essentially, I’m going to document some feature at least once a day and post it here. Hopefully someone will consolidate these in to a real document :)

To kick off this announcement, I’m going to point out yet another reason why Struts is really bad (I won’t say sucks, I already said that in my title :P ). Look at this taglib, last commited by Craig McStruts himself.

There are two important things to note here:

Object args[] = new Object[] { arg0, arg1, arg2, arg3, arg4 };

That is the code that constructs the arg list for internationalizing messages. Notice something terrible bad here? No? Let me spell it out: your i18n messages can only have four arguments! I guess you better start chopping your messages up to support Struts.

The bigger, more annoying thing that this implies is that the number of args is not dynamic. The args are specified as tag attributes arg0, arg1, arg2, and arg3. And since these attributes aren’t evaluated against any sort of expression language, the only way to use dynamic values for these args is to either use javascript (NASTY) or to use &lt%= someString %&gt. Both suck.

There are a few things going on here. In WebWork, this could be done by doing:

<ww:text name="'i18n.key'">
<ww:param value="someExpr"/>
</ww:text>
  • dynamic number of params are supported
  • easy access to a bean property via someExpr

In Stuts “someExpr” wouldn’t work because the only way to access bean properties (formbeans) is via the bean:property tag. And of course, you can’t do a JSP tag in the attribute of another JSP tag (at least not in pre-2.0 days, not sure about post-2.0).

The most disturbing thing of all this is that no one in the Struts community has complained (at least enough) for this to change? This is just typical of Struts users — they either don’t develop any real applications that demand a good framework, or they just live with Struts acting as a very poor wrapper around raw servlets.

13 Comments on “WebWork Doc-a-Day; Struts Really Sucks”

  1. #1 Anonymous
    on Oct 30th, 2003 at 12:49 pm

    First post!

  2. #2 No one
    on Nov 3rd, 2003 at 7:59 am

    I’ve never needed more than 4 arguments for my messages, so struts works fine for my enterprise applications. It also seems to work for IBM, Cinergy and other very big companies. If Struts sucks so bad, explain why 1,000’s of users use Struts and maybe 10 use WebWork. Your attitude is also a good reason to avoid WebWork.

  3. #3 Kris Schneider
    on Nov 3rd, 2003 at 8:07 am

    At least those nasty Struts devs and users can count: arg0 – arg4 allows for five replacement args ;-) .

  4. #4 Matthew Porter
    on Nov 3rd, 2003 at 8:58 am

    No One:
    This is a horrible argument for the use of Struts over WebWork. Do I need to whip out the old saying- “If everyone else jumped off the bridge, would you?” Patrick documented a benefit of WW2 over Struts and this is your rebuttal, instead of examining some way to improve Struts. I am glad it works for you.
    Furthermore, if everyone used your logic, then we would be stuck doing C,C++, or assembly. Hey, IBM and other big companies do work in C++, so there was no need for Java.
    This is not meant as a personal attack on you just your argument. Instead of posting silly comments like yours, go improve Struts so this isn’t true anymore.

    Cheers,
    matthe

  5. #5 Matt P
    on Nov 3rd, 2003 at 9:07 am

    Thats a small tid bit. We need the whole struts vs. Webwork document(with examples). Then we might “get it”. I know your working on it. With everything laid out, I believe the argument would be more compeling.

    People “worked hard” to learn struts. Now you tell them it sucks, however, they don’t really “know” your system and exactly where your coming from. Of course people are going to defend what they know.

    Matt

  6. #6 Another Anonymous Coward
    on Nov 3rd, 2003 at 10:01 am

    Sorry, but have you seen your own framework carefully? Do you really want someone posting each and every HUMONGOUS design fault in webwork?

    I am trying to use your Swing-to-server channel via http (ClientRequest or something like that). Man, it’s unusable. I will have to recode a clean one from scratch. Faulty and not real-world ready.

    Do you really think that starting a column for bitching against other framework is a good idea? Even McFleury gave up on that attitude.

    Keep your own house clean and to the fuck with the others.

  7. #7 Jason Carreira
    on Nov 3rd, 2003 at 10:58 am

    The ClientDispatcher may be a little sucky, but at least you have the OPPORTUNITY TO MAKE ONE. You can’t do this with Struts because of the horrible dependence on HttpServlet*…

    I know some people have used the ClientDispatcher successfully… maybe you should try asking the list and people could help you with your issues?

  8. #8 Tech-Weblog by Christoph C. Cemper
    on Dec 26th, 2003 at 7:21 pm

    Struts Enabler Tools

    If you are interested in more Struts-enablers checkout the German Java Magazin article or the google-translated article describing the tools: Struts Console (free, but not open source) Struts Builder (open source) Easy Struts (open source) Improve Stru…

  9. #9 Tech-Weblog by Christoph C. Cemper
    on Dec 26th, 2003 at 7:25 pm

    Struts Enabler Tools

    If you are interested in more Struts-enablers checkout the German Java Magazin article or the google-translated article describing the tools: Struts Console (free, but not open source) Struts Builder (open source) Easy Struts (open source) Improve Stru…

  10. #10 Anonymous
    on Aug 14th, 2004 at 4:30 am

    JSP sucks because the underlying technology (JSP) is just plain stupid for any web application

  11. #11 Anonymous
    on Aug 14th, 2004 at 4:31 am

    Struts sucks because the underlying technology (JSP) is just plain stupid for any web application

  12. #12 Anonymous
    on Apr 21st, 2005 at 4:55 pm

    The struts devs never saw the light…:-)

  13. #13 iterative
    on Jun 14th, 2006 at 5:09 am

    Why do (or did) so many people use Struts even though it sucks? Here’s the answer:

    http://en.wikipedia.org/wiki/Information_cascade

Leave a Comment