I’ve been looking for a

I’ve been looking for a while for a decent composite view framework for java web apps. Most of the ones I’ve seen so far tend to focus on the view as being a single JSP / Velocity page etc, with dynamic bits inside the page doing conditionals etc. Using taglibs can push some of the logic out of the page itself, but the focus is still on simple pages where the iteration is limited to repeating rows in a table. What if I want the ‘list’ part of my page to contain an arbitrary number of heterogenous components, that have different data fields and need to be displayed differently?

Forgetting trivial things like ‘can it be done’, what I’m considering is to build up a simple composite object model, essentially a collection of beans, whose fields are either strings or other simple beans. What I’d like to do then is go through the collection, select a template for each bean, and insert the bean’s field values into the template. When one of the fields is another bean, lookup the view for that bean, and recurse as necessary. When you get to the end of a bean’s fields, append each populated template to the output stream.

In theory this should allow the designers to design each visual element independently (as a JSP for example), and the overall view would effectively assemble itself based on an object model in memory. No need for conditionals, iteration, or any of that other stuff on the page. Do all the logic in the code, assemble your beans, and splat them onto the page.

Its all a bit speculative at the moment, but I’ll mull it for a while until I realise that it can’t work or (even better) find one that someone prepared earlier.