JSP Taglibs
Admittedly, this is the area I'm the least knowlegable, however, I'd like to throw out there adopting at least the approach taken by WebWork2 for HTML taglibs.
http://www.opensymphony.com/webwork/wikidocs/JSP%20Tags.html
Rather than generating the HTML directly in the taglib, they delegate that to Velocity templates, allowing the user to have complete control over the output of the JSP tag. What about using that approach as our default, yet somehow allowing for a pure Java version if performance becomes an issue?
Beehive NetUI also has a tag library that is described here. We have a similar rendering abstraction as those in WebWork except that NetUI started with rendering abstracted in Java.
Generally, the NetUI tags build up state bags / JavaBeans and pass those to pluggable renderers that are aware of the targeted markup language. Some tag library highlights:
HTML / XHTML rendering and JSP attribute API. One primary goal of the NetUI tags is to provide fully compliant HTML / XHTML markup while allowing addition of non-specification compliant attributes through the NetUI attribute tag.
- fully leverages the features available in a JSP 2.0 container. JSP 2.0 provides some great features like the expression language, .tag files, and simple tags among others.
good in-line error reporting at development time
good framework-level support for JavaScript including infrastructure to collect JavaScript blocks into a single location in the page
higher-level JSP tag sets for rendering trees / data grids / etc.
- tag API for building custom tags leveraging the above
integration with the controller framework in order to provide data binding and data contracts between actions and pages
It might not be hard to build a rendering layer in the NetUI tags that delegates to WebWork's Velocity templates...