How to fill jasper file with beans collection/ArrayList published in server?


I saw method solutions like this (a sample provided below. Ref URL:

        try {
          Map<String, Object> params = new HashMap<String, Object>(1);
          params.put("upit", query);
          JasperPrint jp = JasperFillManager.fillReport(SearchReport.class.getResource(
            params, new JRTableModelDataSource(table));
            return jp;
        } catch (Exception e) {
            return null;

However, there is not a single solution that says how to fill the report with JavaBean collection/ArrayList if the jasper report file is already deployed on the report server and NOT in the local workstation.

Just observe the compiled file (searchuser.jasper) location here: "/com/gint/app/bisis4/client/circ/jaspers/searchuser.jasper" which resides in the local host. But a report published in a report server might be somewhere like: http://someJasperHost:8080/XYZ/searchuser.jasper, isn't it?

Now-a-days, we do not put the .jasper files as bundled with local war/ear file; rather the reports (jrxml and jasper) are meant to be compiled/published on the report server. However, if we have an ArrayList of Java objects (beans/POJOS etc) and we want to fill the .jasper file (which is already published in the report server), how can we acheive that?

Or, in other words,

What is the best way to supply the ArrayList of Javabeans to a jasper report located in a jasper server and fill/populate it?

Is there actually any solution/sample code for this?


mchisty's picture
Joined: Sep 13 2007 - 12:45pm
Last seen: 2 months 6 days ago

1 Answer:

Have you looked into the sample Custom Bean Data Source?

kkumlien's picture
Joined: Jan 22 2015 - 4:36am
Last seen: 3 weeks 6 days ago