Jump to content
Changes to the Jaspersoft community edition download ×

Execute Report Many Times...


2006 IR Open Dicussion

Recommended Posts

By: legion - cajinadiaz

Execute Report Many Times...

2006-02-09 08:44

When I execute a Jasper Report from a JSP page.. the first time is OK.. but when I try to execute again the report it's not loaded..

 

What is happened... ??

 

 

 

 

 

By: TBG - thebiggunner

RE: Execute Report Many Times...

2006-02-09 09:00

Hi.:)

 

without any exception or error message?

 

 

 

 

By: legion - cajinadiaz

RE: Execute Report Many Times...

2006-02-09 09:08

Without any exception..: "Process Exit With Code 0"

 

 

 

 

 

By: TBG - thebiggunner

RE: Execute Report Many Times...

2006-02-09 09:16

Hmmm...could you give us some source?

 

 

 

 

By: legion - cajinadiaz

RE: Execute Report Many Times...

2006-02-09 09:26

Yes.. I can...

I have a Class where I do the connection and display the report...

This is the JSP page... When I call this page the firts time all is ok.. but the second time don't work..

 

*********************************************

<%@ page import="net.sf.jasperreports.engine.*" %>

<%@ page import="net.sf.jasperreports.engine.design.*" %>

<%@ page import="net.sf.jasperreports.engine.data.*"%>

<%@ page import="net.sf.jasperreports.engine.export.*"%>

<%@ page import="net.sf.jasperreports.engine.util.*"%>

<%@ page import="net.sf.jasperreports.view.*"%>

<%@ page import="net.sf.jasperreports.view.save.*"%>

<%@ page import="java.sql.*"%>

<%@ page import="java.util.*" %>

<%@ page import="java.io.*" %>

<%@ page import="datatur.view.utils.*;" %>

 

<html>

<head><title></title>

<script language="JavaScript">

 

</script>

<head>

<%

try{

 

Connection conn = (new Reports()).getMyConnection();

(new Reports()).setSystemProperties( application);

Map parameters = new HashMap();

 

JasperCompileManager.compileReportToFile(application.getRealPath("/reports/CITY_CODES_COUNTRIES.jrxml"));

File reportFile = new File(application.getRealPath("/reports/CITY_CODES_COUNTRIES.jasper"));

 

JasperReport jasperReport = (JasperReport) JRLoader.loadObject(reportFile.getPath());

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);

 

(new Reports()).generateJRViewerOutPut( jasperPrint);

 

reportFile = null;

jasperReport = null;

jasperPrint = null;

parameters = null;

conn.close();

conn = null;

 

}catch (JRException e)

{System.out.println("Error:" +e.getMessage());}

catch (Exception e)

{

e.printStackTrace();

System.out.println("Error2:" +e.getMessage());

}

%>

<body >

</body>

</html>

 

 

 

 

By: TBG - thebiggunner

RE: Execute Report Many Times...

2006-02-09 12:19

It's very interesting, that you don't have any exceptions. The code seems to be good..

What do you mean "the report it's not loaded.."?

 

 

 

 

 

By: TBG - thebiggunner

RE: Execute Report Many Times...

2006-02-09 23:40

Hi. I got the same problem, when i opened the jasper file directly. My solution:

 

JasperDesign JasperDesign=JRXmlLoader.load("order.jrxml");

JasperReport jasperReport=JasperCompileManager.compileReport(jasperDesign);

Connection connprint=dbc.getConnection(); // dbc is my own DataBase connectivity class

JasperPrint jasperPrint= JasperFillManager.fillReport(jasperReport,parameters,connprint);

JasperPrintManager.printReport(jasperPrint,false);

connprint.close();

 

 

 

 

By: TBG - thebiggunner

RE: Execute Report Many Times...

2006-02-09 23:41

of course, you have to create the parameters HashMap.:)

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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