November 13, 2003

Struts vs WebWork

I agree that JSTL can be a bit "verbose", but the metaphors used by JSTL successfully convey their application. Useful metaphors are something that many smart people often overlook when talking about a framework’s proficiency. You may understand what a Result is because you wrote the code, but to a novice, Dispatch is a more readily apparent metaphor. I think that the best example for JSTL being verbose is the choose/when/otherwise tags that are used for logic. However, I am pretty sure I could give a novice developer a JSTL book and he would quickly understand how to use those tags. “CHOOSE one of these groups WHEN this is true or WHEN this is true, OTHERWISE do something else.”

Good metaphors are one of the reasons why Struts makes sense. Struts has Actions, they do things, and Forms, you fill them out, and it is all nicely tied together with a simple XML file. Simple.

Deriding JSTL for flexibility is short-sited. Claiming Struts is inferior because it only does web applications is nonsensical. From the Struts web site, “Welcome to Struts! The goal of this project is to provide an open source framework for building Java web applications.” I think it is pretty impressive that they are staying focused on one thing instead of trying to be everything to everyone.

Struts and JSTL are attractive because they are flexible. If you are a novice, you can easily get started and build a nice site. Said site won't win "code of the year" awards, but it will work. You don't have to know IoC, Command Pattern or whatever is vogue this month to make a Struts site. If you need a more robust system, then Struts will get you there, maybe not as elegantly, but you will get there (see Roller).

I believe Russ said it best, but I will summarize with, “Why build a web app when a JSTL page will do?”

I recently built a tool in JSTL. 1 file, 60 lines. If I built the same tool in Struts I would need to create a JSP, Action and Form and then I would also have to change the struts-config.xml. JSTL may be "so 1995" but there is serious power in those 60 lines all packaged nicely in one file. Use the right tool for the job. Struts and JSTL may not be very sexy, but they get the job done, with a low barrier to entry to boot.

Posted by carl at November 13, 2003 07:24 AM

Comments

Well put.

Posted by: Don Brown at November 13, 2003 05:19 PM