Jump to content
JasperReports Library 7.0 is now available ×

how to use bean as datasource


Recommended Posts

By: subesingh - subesingh1

how to use bean as datasource

2006-04-17 06:20

To use bean class as data source i have written a bean class and a bean factory class. as given below

 

package com.klgsystel.vidushi.billing.printing;

 

import javax.swing.table.AbstractTableModel;

import java.util.Collection;

import java.util.Arrays;

import net.sf.jasperreports.engine.JRField;

import net.sf.jasperreports.engine.JRDataSource;

import net.sf.jasperreports.engine.JRException;

 

 

 

public class PrintBillDataSource

{

 

 

/**

*

*/

 

private static Object[] data;

 

 

public PrintBillDataSource(Object[] data0)

{

data = new Object[] { new CustomBean()};

}

 

 

/**

*

*/

public static Object[] getBeanArray()

{

return data;

}

 

 

/**

*

*/

public static Collection getBeanCollection()

{

return Arrays.asList(data);

}

 

 

 

 

}

 

 

 

But I do not understand how it map the jasper text field with columns

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...