Jump to content

ireport custom datasource


sazoo25

Recommended Posts

I have this program, which I will be using arraylist as the datasource. The problem is how do I access the arraylist in ireport?

 

here's part of the code:

 

ArrayList results = (ArrayList)session.getAttribute("pdf");

JasperPrint jasperPrint = JasperManager.fillReport(jasperReport,parameters,new JRBeanCollectionDataSource(results));

 

thanks

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

If arraylist is an array of properly formatted beans, then you just refer to each field in the bean as a field in the report.

i.e.

 

public class Test {

private String myTestString;

 

public void setMyTestString(String s) {myTestString = s;}

public String getMyTestString() {return myTestString;}

}

 

The field in this instance would be $F{myTestString}.

 

HTH,

Robin

Link to comment
Share on other sites

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...