My post may be too late, but it sounds like what you are trying to accomplish is dynamic report generation or possibly parameterized reporting - both of which the Pentaho platform can help you with.
The platform is a solution based BI application that supports dynamic selection of data for inclusion in a report, as well as dynamic report templates. The Pentaho report engine (formerly JFreeReports) is the easiest to work with from the Pentaho perspective - we have a report design wizard to assist you in building reports and templates. You can also achieve similar results using the Pentaho components built-in for BIRT or JasperReports as well.
You should download the demo, which is a preconfigured installation of JBoss AS, JBoss Portal, and Pentaho. The demo contains samples of dynamic reporting, delivered both through the portal and via JSP/servlet.
You can get the latest demo at http://www.pentaho.org/download/latest.
If you need any help getting your solution going, please don't hesitate to use our forums - our community is eager to help get new solutions up and running! http://www.pentaho.org/discussion.
Pentaho Community Open Source-eress