Jump to content
We've recently updated our Privacy Statement, available here ×

How can I call Jasper Report file from swing


Recommended Posts

By: ccatindia - ccatindia

How can I call Jasper Report file from swing

2003-12-11 01:10

We are the peoples involved in one swing application project.We are using jasper reports

for reporting purpose.We didn't how to call jasper report from our application.So please give some example coidings for calling the report with parameter passing.

 

Thanking you.

 

CCAT

 

 

 

 

By: Carlos Costa e Silva - carloscs

RE: How can I call Jasper Report file from swing

2003-12-11 04:57

Look in demosamplesjasperJasperApp.java for an example.

 

 

 

 

 

By: Alexander Wallace - aows

RE: How can I call Jasper Report file from swing

2003-12-11 11:06

something like this will show the jasper viewer:

 

public static void viewReport(JasperPrint jp) {

try {

if (jp != null)

JasperViewer.viewReport(jp, false);

}

catch (Exception e) {

}

}

 

you need to create a jasper print object and pass it to that method... No much sense in making an example of that since there is way too many different ways of filling up reports... It's easier if you check demo/samples/datasource example that comes with the source for jasper reports.

 

To pass parameters to a jasper reports you just create a hash map, put parameter keys and values in and then pass it to the jasperFillManager like:

 

Map parameters = new HashMap();

parameters.put("reportWhereClause", 'WHERE ID >0");

jp = JasperFillManager.fillReport(ClassLoader.class.getResourceAsStrea

m("/com/whatever/swing/reports/AReport.jasper"), parameters, cn);

 

Hope this helps... but check the examples in the demo/samples directory, they have all you need...

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