May 20, 2003

Strutting your web application

Jakarta Struts probably is the most famous web application framework in the Java Community. Although it has some good features many others are more or less neglectable.
Considering Struts as your web application framework you should be aware of some important issues.
The Struts implementation is not as one might want it to be. For example it doesn't support interceptors for request parameter binding. Such a mechanism is required if you need to seemlessly convert data formats before storing the data in transfer objects (in Struts called FormBeans). Furher implementation details make the web programmer's life more uncomfortable. Because of forcing FormBeans to be derived from a special base class, it keeps the FormBean from being reused in the ejb tier, if you did't want to have dependencies from the ejb tier the web tier. That's when you start some wild data copying.
Struts does not support any output formatting required by many web applications. For that purpose you have to add formatted output methods for each attribute that has to be formatted.
I could continue the list. Most of my points are valid for Struts 1.0.2 as well as for Struts 1.1. Even if Struts had some good features it doesn't have to be so large.
If I was again in a project thinking about using Struts as a third party library - without adapting it to the project's needs, I probably would not use Struts.

An alternative could be Tapestry that's becoming a Jakarta project, too. Though it probably takes more time than Struts to master. If I had to stick to Struts, I'd just use a well-defined and adapted subset.

Posted by Phillip Ghadir at May 20, 2003 9:36 AM | TrackBack
Comments

A comment, just for the fun of it ;-)

Posted by: Stefan Tilkov at May 21, 2003 12:39 PM

I agree with what you are saying here. I wrote up some thoughts on some issues with Struts. http://www.picklematrix.net/archives/000284.html

Posted by: Seth Ladd at August 8, 2003 2:29 AM

Everything is right. I used WO 4.5-5.1.3 for some years. Our big customer switched to struts and we must follow..:(-..I hate struts...poor html tags, poor bean tags (where is the fucking formatter?), poor logic tags (objects that be allowed to be null throws NullPointerException). Yes, wild wild wild data copying. In WO and EOF everything is more "objective". Everything is at the right place. No FormBeans, better relationship handling. Less configuration (validator-rules.xml, struts-config.xml)...I could continue the list, too...:-)

Posted by: Michael at September 8, 2003 9:54 PM

I won't air my opinions on Struts.

As for Tapestry, it was designed
with some very strange assumptions.
These gotchas are under the covers and not documented, but they're there.
In particular, actions
coming the client are processed in exactly
the same order as they are rendered on
the page. In many applications (web
or otherwise), the order of processing
is critical and often must be carefuly
controlled. So executing client requests
based on an accidental order (the
rendering order) is cause for concern.
In fact, you can change the server-side behavior of your Tapestry application by changing the client-side page layout!

Posted by: Stefan at September 21, 2003 2:13 AM
Post a comment









Remember personal info?