I've worked with the struts tags a bunch in extending them for application specific purposes (injecting authorization controls to disable components), developing custom themes, and in developing an ajax framework extending these tags and though I am very happy with the tag library in general, there is one unsettling design point that I keep coming across:
It seems intuitive to me that tags can/should be categorized into certain 'functional groups' and an inheritance hierarchy be used to consolidate common functionality into abstract base tags (for example: Input, Interactive, Container..) which concrete implementations inherit. Because tags/models can be so verbose, there is a significant benefit here for code reuse and maintenance. The problem is that one tag/component may typically exhibit multiple 'functions' and given the lack of multiple-inheritance, the only way to accomplish is this is using some sort of delegate pattern which quickly becomes just as verbose. The struts2 tags seem to take a mid-way approach in which they implement a lot of 'standard' functionality in a few abstract base tags (see UIBean, ListUIBean...) but don't really try to 'normalize' the functionality too much. The problem with this is that you end up having a ton of attributes for every tag, many of which are not really implemented or meaningful for a particular tag (ex: requiredposition or ondblclick for the FormTag). It's not the worst thing in the world, but it makes things a bit more confusing than they need to be especially if you are extending the tags and don't want to implement *all* the attributes provided. I also really like the approach taken with the javatemplates template . Something like this applied to the tags would allow a much more discreet segmentation of tag functionality which could be then 'plugged in' to each tag as required. It sort of seems like a paradigm for reusing multiple concerns in java without multiple inheritance - which is what this would need. - Eric Though I am also a big fan of the struts tags, there is one particlar thing that has always troubled me when trying to extend them for On Tue, Aug 11, 2009 at 5:51 PM, Wes Wannemacher <w...@wantii.com> wrote: > Don, > > As you know, there are many aspects to the taglib that make it > interesting. One big thing that you mention is the use of the tobago > plugin to generate the TLDs and marking parameters as attributes with > an annotation. I'm guessing this was done at some point to make the > taglib more manageable, but I've used this facility to generate my own > tags for apps... It is a much friendlier setup than linking against > jsp-api directly and trying to build the tag from scratch. > > Personally, I don't use Freemarker for Velocity, so the fact that it > works outside of JSP is nifty, but of no real use to me. Although, I > have used freemarker to generate email messages, I don't find myself > using any struts tags in there, I generally just populate the model > and render the template... > > I will say that that the theming is what sells it for me. I like > breaking down the UI using the struts themes and sitemesh. My JSPs are > very slim, it's not uncommon to find pages that just look like this - > > <html> > <title>blah</title> > <body> > <div id="pageHeader">stuff</div> > <div id="pageForm"> > // struts form tags > </div> > </body> > </html> > > Part of the reason is that I am terrible at UI design. If left up to > me, sites that I work on would look like someone barfed up their > alphabet soup. It's just my nature, I was a terrible dresser until my > wife taught me the basics and I still struggle sometimes. The > templating allows me to apply a consistent look and Yes, I customize > it quite often. I'd imagine that there are other ways to get the same > result, but the s2 tags are a good fit. The elements being glued to > the server-side components (via OGNL, etc.) and worry very little > about anything other than the java end of things. Then, I can work > with people wise in the ways of art to make the sites/tools actually > be appealing to look at. > > HTML is just too flexible and there are too many ways to get the same > output, so I generally look for consistency and manageability. Then, I > can just browse places like this - http://www.openwebdesign.org to > find a template that I like. It's usually trivial to convert one of > those into a sitemesh decorator. The templateability of the tags lets > me make the small changes I want to make things fit into the > site-template I choose. > > Another thing that is useful is the overall design. The available tags > make sense for the way I work. I am not sure if it is because I've > trained my brain to approach problems a certain way after using > struts2 for so long, or if they are just that good. But, I use tags > like s:if / s:else and s:iterator quite a bit. I like exposing things > from the action and being able to get to them in a uniform manner in > the UI. I use the form tags quite a bit as well, but the whole package > just seems like it is exactly what I would want it to be. There are > some tags I stay away from though because I don't usually find any use > for them - s:optiontransferselect and s:action... I can't say that > I've ever used them and I probably wouldn't. For the situations where > I have to manage a set of lists I would rather use AJAX than a really > complicated form tag. > > On Tue, Aug 11, 2009 at 10:19 AM, Don Brown<mr...@twdata.org> wrote: > > At Atlassian, every application seems to have picked a different web > > framework and template engine to use. As we are finally starting to > > do some common UI work, I'm wondering if the Struts 2 tag library > > framework is worth basing our tag library on. Assume it wouldn't be > > too hard to extract mostly as-is: > > * Is the design solid? > > * How limiting do you find it over native tags/macros in the > > respective template engines? > > * How useful is the theme system really? For example, properties that > > are only used by some themes are confusing and error-prone. > > * Any performance bottlenecks outside all the OGNL usage? > > * Would Struts be interested in the result? > > > > The benefits I see are: > > * Support for Velocity, Freemarker, and JSP > > * Overridable, customizable Themes > > * Ability to plug in a new template engine > > * Generated tld and docs > > > > While I've worked a bit on the tags from a struts dev pov, I've > > haven't used them much myself. My gut feel is it would be worth it in > > the short and long term, however I remember some discussion about > > their design and value, so I'd like to revisit those concerns. > > > > BTW, was digging around in the javatemplate stuff...very impressive! > > It is cool to see simple prototype code turned into a full featured > > library. Any thoughts on how that sax-like design worked out? Should > > it have been a more DOM-like object model instead? > > > > Don > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > > For additional commands, e-mail: dev-h...@struts.apache.org > > > > > > > > -- > Wes Wannemacher > > Head Engineer, WanTii, Inc. > Need Training? Struts, Spring, Maven, Tomcat... > Ask me for a quote! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > For additional commands, e-mail: dev-h...@struts.apache.org > >