How to access JAVABEAN into Jaspersoft studio 6.3.1


JAVA Code  generating report :


final Map<String, Object> params = new HashMap<>();final com.pojos.jasper.ReportDataExport obj = new com. pojos.jasper.ReportDataExport(Export); params.put(DETAIL_REPORT, obj);
final InputStream inputStream = loadFolderTemplate(TEMPLATE); final JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, params);
final byte[] exportedReport = JasperExportManager.exportReportToPdf(jasperPrint);

Code in java bean: ReportDataExport.Java

public List<String> getdetails() {List<String> datalist = new ArrayList<>();final int size1 = Export.getdetails().getdata().getdata().size(); for (int i = 0; i <= size1; i++) {final String data = Export.getdetails().getdata().getdata().get(i).getLongName();datalist.add(data); } return datalist; }
public getname() { final com.export.pojos.jasper.DataExport names = Export.getdetails().getdata().getdata(); return names;

Soruce code:Mailreport.jrxml

<parameter name="DETAIL_REPORT" class="com.pojos.jasper.ReportDataExport"/> <textFieldExpression><![CDATA["Display " +$P{ DETAIL_REPORT }. getdetails () +”Names” +$P{ DETAIL_REPORT }.getname()]]></textFieldExpression> </textField> <componentElement><reportElement x="235" y="602" width="200" height="200" uuid="3034abb7-4b3b-4cc5-aa0e-bbdfc1575d10"> property name="" value=""/> <property name="" value="Table_TH"/>                   <property name="" value="Table_CH"/><property name="" value="Table_TD"/>  </reportElement> <jr:table xmlns:jr="" xsi:schemaLocation="">   <datasetRun subDataset="ExportData" uuid="cbbcef17-97bf-4037-b18b-82720b679991"> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression> </datasetRun> <jr:column width="40" uuid="9146baba-0612-4aaf-91be-5ff91456a1cb"> <jr:tableHeader style="Table_TH" height="30"/><jr:tableFooter style="Table_TH" height="30"/> r:columnHeader style="Table_CH" height="30"/>                       <jr:columnFooter style="Table_CH" height="30"/><jr:detailCell style="Table_TD" height="30"/>  </jr:column>  </jr:table> </componentElement>  </band>  </title></jasperReport>

I got a output as Data [xxx,yyy] Names[Thomas,Riche]

I need to return the datalist() and getname() in table format with column name “DATA” and “NAME” and Table needs to be adjusted automatically if datalist() and getname() returns large value.

I droped a table icon inside report and 1. Create new datasource with name Dataset1. Next it showed empty dataset without any field. Don’t know how to proceed with. Please help me out.

I saw some tutorail but its for ireport to create beandatasoruce. Appreciate your early response.

spraveenk90's picture
Joined: Nov 3 2016 - 2:36am
Last seen: 4 years 3 months ago

0 Answers:

No answers yet