The FormattedDataSet is an open source java tool that creates dynamic content including html and xml. It does a great job of separating data and formatting and both are reusable independently. It is also fast and easy to use. See the web site for an explanation, examples and a live demo.
In addition it has several useful utility classes that are useful even if you don't use the FormattedDataSet class mentioned above. This weekened I added a new class called ArraySQL. Below are my release notes from SourceForge.
The ArraySQL was added to the FormattedDataSet API. ArraySQL allows SQL like synax to be applied to Arrays. This class can be used with the FormattedDataSet or as a standalone utility class. The API also has the ability to convert ResultSet's into 2 dimensional Arrays. This allows you to query ResultSets as the following example shows. See the javadocs at http://www.fdsapi.com for more examples.