可以将java文本字段中的数据发送到jasper报告而无需数据库交互吗? [英] Can data in a java text field be sent to jasper report without database interaction?
问题描述
我们正在使用netbeans在java中开发桌面应用程序。我们已经为netbeans安装了jasper报告,并且能够根据数据库中的数据设计报告。
We are developing a desktop application in java using netbeans. we have installed the jasper reports for netbeans and are able to design the reports from the data in the database
有一个表格我们要打印而不存储数据数据库。我们可以将表格数据发送到jasper报告吗?
There is a form which we want to print without storing the data in the database. Can we send the form data into jasper report?
请解释
推荐答案
是的。如果它只是一个值,您只需在报告的参数映射中设置它,并使用 $ P {foo}
访问它(意味着值在地图,在键foo
)。如果它是您要在报告的详细信息区域中迭代的值列表,则可以使用 JRBeanCollectionDataSource
。
Yes. If it's just one value, you just have to set it in the parameters map of the report, and access it using $P{foo}
(meaning the value is tored in the map, at the key "foo"
). If it's a list of values you want to iterate on in the details band of the report, You may use a JRBeanCollectionDataSource
.
您将能够访问集合中bean的每个属性(通过其getter方法): $ F {foo}
将调用你的bean的 getFoo()
方法来获取字段值。
You'll be able to access each property (throught its getter method) of the beans in the collection: $F{foo}
will call your bean's getFoo()
method to get the field value.
这篇关于可以将java文本字段中的数据发送到jasper报告而无需数据库交互吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!