你email是多少/?
我有官方教程

解决方案 »

  1.   

    非常感谢楼上的,不过好像还是没说清楚subreport所需的datasource一般是动态的,不太可能做为parameter扔一个静态的datasource进去,那也没什么意义,还不如不用subreport.如果动态的话我猜可能是datasource的嵌套或是用反射调用某个生成subreport datasource的方法,可惜这两种我都没试出来另附原文9.2 Subreport Data Source
    Subreports need a data source in order to generate their content, just like normal report do.
    In the 3.4 Filling Reports chapter of this book we have seen that when filling a report you have to
    supply either a data source object or a connection object, depending on that particular report type. That
    is if it has an internal SQL query and you want to have it executed to obtain the report data or you
    supply the report data yourself.
    Subreports behave in the same way and expect to receive the same kind of input when they are being
    filled.
    You can supply to your subreport either a data source using the <dataSourceExpression> element
    or a JDBC connection for the engine to execute the subreport's internal SQL query using the
    <connectionExpression> element. These two XML elements cannot be both present at the same
    time in a subreport element declaration. This is because you cannot supply both a data source and a
    connection for your subreport. You have to decide on one of them and stick to it.
    The report engine expects that the data source expression returns a
    dori.jasper.engine.JRDataSource object and that the connection expression returns a
    java.sql.Connnection object, whichever is present.
    You can see how subreports work, if you check the subreport sample.
      

  2.   

    应该不行吧,好像一般的用法是从Datasource读取Connection而已,而不是替代
      

  3.   

    从Datasource读取Connection而已???you have to supply either a data source object or a connection object不知道你的datasource是指什么?我没猜错的话你指db connection pool吧,jasperreport里datasource和connection完全是两个概念