Problem with Jasper Reports
hi evrybody... i'm having a problem while using Jasper Reports. I'm trying to Export a jrxml file generated by JasperAssistant plug-in in eclipse. but all i'm having is an exception. the following is my code and the said exception:
CODE:
public class DataSourceApp
private static final String TASK_HTML = "html";
private static final String TASK_XLS = "xls";
private static final String TASK_CSV = "csv";
private static final String TASK_RUN = "run";
public static void main(String[] args)
String fileName = null;
String taskName = null;
taskName = "html";
fileName = "path\\DataSourceReport.jasper";
try
long start = System.currentTimeMillis();
if (TASK_HTML.equals(taskName))
JasperPrint jPrint = new JasperPrint();
HashMap parameters = new HashMap();
Connection con = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:BOM_DSN","","");
jPrint = JasperFillManager.fillReport("path\\DataSourceReport.jrxml", parameters, con);
JasperExportManager.exportReportToHtmlFile(fileName);
System.err.println("HTML creation time : " + (System.currentTimeMillis() - start));
System.exit(0);
catch (JRException e)
e.printStackTrace();
System.exit(1);
catch (Exception e)
e.printStackTrace();
System.exit(1);
EXCEPTION:
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
at datasource.DataSourceApp.main(DataSourceApp.java:184)
NESTED BY :
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
at datasource.DataSourceApp.main(DataSourceApp.java:184)
NESTED BY :
net.sf.jasperreports.engine.JRException: Error loading object from file : C:\Eclipse\eclipse\workspace\test\BOM_Package\DataSourceReport.jrxml
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:89)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
at datasource.DataSourceApp.main(DataSourceApp.java:184)
Caused by: java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
... 2 more
hope you can help me asap.. thanks!
--joms
HI All
I am working on Jasper report Project and when i am filling the report through
JasperFillManager.fillreport(String sourceFileName,Map parameters,Connection conn)
I am getting following exception:(I have included common-collections 3.2.jar in my classpath)
java.lang.NoClassDefFoundError: org/apache/commons/collections/ReferenceMap
at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.<clinit>(JRAbstractJavaCompiler.java:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:489)
at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:243)
at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:411)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:418)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
Please Suggest ;Thanks in advance
Similar Messages
-
Problems with jasper report pdf exporting
Hello,
I coded a simple servlet to view a jasper report (created with iReport) after clicking on the right button in the jsp.
Here is the problem:
net.sf.jasperreports.engine.JRRuntimeException: Error evaluating expression :
Source text : (java.awt.Image)it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(new String[]{"chartName=Pie3D","depthFactor=0.2","titlePosition=1","width=245","plotBackground=[255,255,255]","serie1=SERIE_CONTA_RISPOSTE","serie0=SERIE_RISPOSTA","foregroundAlpha=0.33","tooltips=false","chartBackground=[255,255,255]","subtitle=","title=","legend=true","quality=2","height=168","antialias=true"}, (it.businesslogic.ireport.IReportScriptlet)$P{REPORT_SCRIPTLET})
net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:604)
net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:343)
net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)
net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1302)
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:228)
net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:730)
net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:632)
net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:203)
customer_care.servlet.Reporting.getReport(Reporting.java:74)
customer_care.servlet.Reporting.processRequest(Reporting.java:50)
customer_care.servlet.Reporting.doGet(Reporting.java:89)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Here is the code:
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
byte[] byte_array = null;
try{
File reportFile = new File(this.getServletConfig().getServletContext().getRealPath("/reports/torte_call_center_agenzie.jasper"));
if (!reportFile.exists()) throw new JRRuntimeException("File jasper non trovato");
String nomeFile = reportFile.getPath();
Map parameters = new HashMap();
parameters.put("codice_questionario", "2"); //just for testing
ConnettitiAlDB c = new ConnettitiAlDB();
Connection conn = c.Connettiti(Conf.db_principale);
byte_array = JasperRunManager.runReportToPdf(fullpath_filename, parameters, connessione);
conn.close();
catch(JRException e){
e.printStackTrace();
catch(SQLException e) {
e.printStackTrace();
response.setContentType("application/pdf");
response.setContentLength(byte_array.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(byte_array, 0, byte_array.length);
ouputStream.flush();
ouputStream.close();
}Any suggestion? That would be vital to me!
Thanks in advancecatching the JRRuntimeException and printing its stacktrace i saw that the jfree chart lib was missing.
i put it in my libraries but now i got this error:
java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfContentByte.transform(Ljava/awt/geom/AffineTransform;)V
net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:1468)
net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:484)
net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:448)
net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:413)
net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:250)
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdf(JasperExportManager.java:188)
net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:205)
customer_care.servlet.Reporting.getReport(Reporting.java:77)
customer_care.servlet.Reporting.processRequest(Reporting.java:50)
customer_care.servlet.Reporting.doGet(Reporting.java:92)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.lowagie.text.pdf.PdfContentByte.transform is inside the iText library.
I had an old version so I updated it but nothing changed.
Any suggestion?
Thanks -
Date problem with jasper reports
I need to pass the date values as a parameter to the jasper reports and process it in the report, how can achieve it please give me a brief explanation, i need the date value for processing a sql statement in the jasper report please help me a sample code
from=first date value;
to=second date value;
//i need to pass the date as the parameter how can i achieve it
HashMap hm = new HashMap();
hm.put("fromdate", from);
hm.put("todate", to);
JasperPrint jasperPrint;
jasperPrint = JasperFillManager.fillReport("W:/ReportWorks/Estimation Reports/Dailyreport ItemWise.jasper",hm, con);
JasperViewer.viewReport(jasperPrint,false);HI All
I am working on Jasper report Project and when i am filling the report through
JasperFillManager.fillreport(String sourceFileName,Map parameters,Connection conn)
I am getting following exception:(I have included common-collections 3.2.jar in my classpath)
java.lang.NoClassDefFoundError: org/apache/commons/collections/ReferenceMap
at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.<clinit>(JRAbstractJavaCompiler.java:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:489)
at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:243)
at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:411)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:418)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
Please Suggest ;Thanks in advance -
I want to edit with jasper report so I have this 2 classes.In the first I have this method
private Map parameters;
public void addParametre(String nom, Object valeur)
if(parameters == null)
parameters = new HashMap();
parameters.put(nom, valeur);
and the second class I have this method
public String editionAction() {
ReportGeneratorImmat ge =new ReportGeneratorImmat((String)getForRep().getValue()) ;
String pWhere="matr='145-A' and";
String pOrder="order by nom";
ge.addParametre("P_WHERE",pWhere);
ge.addParametre("P_ORDER",pOrder);
return null;
the problem is that the first parametre (P_WHERE) is successfully added but the the second (P_Order) no. So how can I add both?Seems that this question would be better asked on the Jasper Report forums, no?
John -
Trying to generate a pdf with jasper reports
Fellas,
i hav trying to generate a pdf with jasper reports, but i cant. I create a file .jasper with iReports. This is my code:
emite.java
package utilitarios;
//import net.sf.jasperreports
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.view.JasperViewer;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import java.util.HashMap;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class emitebl {
private static Connection getConnection( ) throws ClassNotFoundException, SQLException{
String driver = "org.postgresql.Driver";
String url = "jdbc:postgresql://localhost/sist";
String user = "usuario";
String password = "";
Class.forName(driver);
Connection con = DriverManager.getConnection( url, user, password );
return con;
public void geraRelatorio( ) throws JRException, Exception{
Connection con = getConnection( );
Statement stm = con.createStatement( );
String query = "SELECT * FROM emissaobl WHERE id=4";
ResultSet rs = stm.executeQuery(query);
JRResultSetDataSource jrRS = new JRResultSetDataSource(rs);
Map parameters = new HashMap();
JasperFillManager.fillReportToFile("emitebl.jasper",parameters,jrRS);
JasperExportManager.exportReportToPdfFile("emitebl.jrprint");
JasperViewer.viewReport("emissao_bl.pdf",false);
} emissao.jsp:
<%@ page import="utilitarios.*" %>
<%
new emitebl().geraRelatorio();
%>Following the error message exception:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: emitebl.jasper
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.emissaobl.exportapdf_jsp._jspService(exportapdf_jsp.java:76)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
root cause
net.sf.jasperreports.engine.JRException: emitebl.jasper
net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:73)
net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:270)
utilitarios.emitebl.geraRelatorio(emitebl.java:37)
org.apache.jsp.emissaobl.exportapdf_jsp._jspService(exportapdf_jsp.java:54)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)where i hav to put the .jasper file?Hi,
If you have placed your .jrxml file say in C:\reports, and when you use compileReportToFile(jrxmlFileName), then the jasper file will be created in the same directory C:\report with the same file name with .jasper extension. If you want a pdf report then specify the same location and file name with '.pdf' extension as destination .
Hope this helps -
Problems with a report generated as PDF
I am having a problem with my report when it is generated as a PDF file from the reports server. A space is added soon after the letter w in all the words where there is letter w; for example, the word awake appears as aw ke, will appears as w ill, etc. Does anyone know how to fix this problem? I am using Reports 11g. Thanks.
Hi
In layout change the font (Redo font) thru menu option (Not Font) Format -> Font >Western.
This may solve your problem...
user8655468 wrote:
I am having a problem with my report when it is generated as a PDF file from the reports server. A space is added soon after the letter w in all the words where there is letter w; for example, the word awake appears as aw ke, will appears as w ill, etc. Does anyone know how to fix this problem? I am using Reports 11g. Thanks. -
The problem with forecast reports in SCOM 2012 after integration with VMM 2012
Hello.
I have problem with forecast reports in SCOM 2012 after integration with VMM 2012. All other reports (not forecasting) works fine. For example, report “Host Group Forecasting” don’t work. The report is generated, but I have error: “Subreport
could not be shown”. I find only errors in SQL Server Reporting logs like this:
library!ReportServer_0-13!1758!06/26/2012-18:26:23:: i INFO: RenderForNewSession('/Microsoft.SystemCenter.VirtualMachineManager.2012.Reports/Microsoft.SystemCenter.VirtualMachineManager.2012.Report.ForecastHostGroup')
processing!ReportServer_0-13!1758!06/26/2012-18:26:28:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Не удалось выполнить
запрос для набора данных "DiskSpaceUsageForecasting". ---> Microsoft.AnalysisServices.AdomdClient.AdomdErrorResponseException: Execution of the managed stored procedure GetTimeSeriesForecast failed with the following error: Exception has been thrown by
the target of an invocation..
Query (5, 58) Parser: The syntax for '6' is incorrect.
at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.IExecuteProvider.ExecuteTabular(CommandBehavior behavior, ICommandContentProvider contentProvider,
AdomdPropertyCollection commandProperties, IDataParameterCollection parameters)
at Microsoft.AnalysisServices.AdomdClient.AdomdCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.AnalysisServices.AdomdClient.AdomdCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.ReportingServices.DataExtensions.AdoMdCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.RunEmbeddedQuery(Boolean& readerExtensionsSupported, Boolean& readerFieldProperties, List`1 queryParams, Object[] paramValues)
--- End of inner exception stack trace ---;
The Russian string “Не удалось
выполнить запрос для набора данных "DiskSpaceUsageForecasting"” is translated to “Could not execute query for data set "DiskSpaceUsageForecasting"”.
I have clean installation SCOM 2012 RU1, VMM 2012 RU1. Integration SCOM with VMM work fine.
SQL collation for all SQL DB instances (SCOM and VMM and SCOM reporting) – “SQL_Latin1_General_CP1_CI_AS”
SQL Analysis service: SQL collation – “Latin1_General” ; language for the server – English (United States)
I think the problem in regional settings. By my opinion there are two possible mistakes:
SQL collation for all SQL DB instances. May be need use “Latin1_General_CI_AS”
as provided by
http://blogs.technet.com/b/momteam/archive/2012/05/25/clarification-on-sql-server-collation-requirements-for-system-center-2012.aspx
Need change regional setting. Question is for what (OS regional setting, SQL Analysis service settings,…) ?Error: Subreport could not be shown
Opening a report for Client Security might result in the following error being displayed in one or more areas of the report: "Error: Subreport could not be shown."
Background
There are two possible reasons for this error:
1. Wrong location The reporting server is pointing to the wrong computer running SQL Server or a SQL Server instance.
2. Insufficient permissions The account configured (in SQL Server Reporting Services) to connect to the reporting database does not have appropriate permissions for the database.
Solution
To determine which reason is causing the error, attempt to directly open the subreport reporting the error, by clicking the name of the subreport.
If the reporting server is pointing to a wrong location, the report displays an error similar to the following:
Error message
An error has occurred during report processing.
Cannot create a connection to data source 'SystemCenterReporting'. Cannot open database "SystemCenterReporting" requested by the login. The login failed. Login failed for user username.
To verify the correct SQL Server computer and instance path
In Report Manager, navigate to the report generating the error and click the Properties tab.
Click Data Sources and under a Shared data source, note the path.
Open the reporting Web site. If you chose the default virtual directory for reports, the URL is: http://hostname/Reports/
If you chose to secure the viewing of reports with HTTPS, the URL is: https://hostname/Reports/
Click SCDW.
In the Connection type list, ensure that Microsoft SQL Server is selected.
In the Connection string box, ensure that the correct SQL Server computer and instance name are entered.
Note:
A period (.) denotes the local computer.
If the account has insufficient permissions, the report displays an error similar to the following:
Error message
An error has occurred during report processing. (rsProcessingAborted) Query execution failed for data set 'DSDashboardComputersTrend'. (rsErrorExecutingCommand) EXECUTE permission denied on object 'prSAS_UX_DashboardComputersTrend', database 'SystemCenterReporting',
schema 'dbo'.
To determine if you are experiencing the SQL Server permissions issue
Open the reporting Web site. If you chose the default virtual directory for reports, the URL is:http://hostname/Reportserver/
If you chose to secure the viewing of reports with HTTPS, the URL is:https://hostname/Reportserver/
Click Microsoft Operations Manager Reporting, click Microsoft Forefront Client Security, and scroll to DashboardComputersTrend.
Click DashboardComputersTrend.
If you are experiencing a SQL Server permissions issue, an error similar to the preceding error appears.
To grant permissions to the SQL Server computer
1. In Report Manager, click SCDW and note the account in the Connect using section. This is the account under which the database is contacted.
2. On the server with the System Center Reporting database, start SQL Server Management Studio.
3. In the tree, expand Security, and then expand Logins. Do one of the following:
If the user account is listed, right-click the account, click Properties, and then go to step 5.
If the user account is not listed, right-click Logins and choose New Login.
4. In the Login name box, enter the user account (domain\username).
5. In the Login Properties dialog box, click User Mapping, and then under Users mapped to this login, select the System Center Reporting check box.
6. Under Database role membership for: System Center Reporting, select the db_owner check box, and then click OK.
Thanks,
Yog Li
TechNet Community Support -
Report viewer "Go To Next Page" button always load Page2 with Crystal Reports Runtime version 10.0.10. No problem with Crystal Reports Runtime version 10.0.5.
NOTE: I did not check other Crystal Runtime versions.
Any solution?Visual Studio Premium 2012.
It is a web application.
It was working fine with Crystal Report version 13.0.5. Only change is uninstall Crystal Report version 13.0.5 and install Crystal Report version 13.0.10
Entering page number works fine to view that page Request.Form parameters sample for that (change page from page 3 to page 5):
__CRYSTALSTATEviewer:{"0":{"rptViewLabel":"Ana Rapor", "gpTreeCurrentExpandedPaths":{}, "vCtxt":"/wEXAwUVSXNMYXN0UGFnZU51bWJlcktub3duZwUOTGFzdFBhZ2VOdW1iZXICBQUKUGFnZU51bWJlcgIC", "pageNum":2}, "common":{"width":"100%", "Height":"100%", "enableDrillDown":true, "drillDownTarget":"_self", "printMode":"Pdf", "displayToolbar":true, "pageToTreeRatio":6, "pdfOCP":true, "promptingType":"html", "viewerState":"/wEXBAUkU3lzdGVtLldlYi5VSS5XZWJDb250cm9scy5XZWJDb250cm9sDxYGHgVXaWR0aBsAAAAAAABZQAcAAAAeBkhlaWdodBsAAAAAAABZQAcAAAAeBF8hU0ICgANkBQJodAUGX2JsYW5rBQ9SZXBvcnRWaWV3U3RhdGUXCAUDZHBpAngFB0lMT0lVSVNoBQdGYWN0b3J5BZYBQ3J5c3RhbERlY2lzaW9ucy5SZXBvcnRTb3VyY2UuUmVwb3J0U291cmNlRmFjdG9yeSxDcnlzdGFsRGVjaXNpb25zLlJlcG9ydFNvdXJjZSwgVmVyc2lvbj0xMy4wLjIwMDAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj02OTJmYmVhNTUyMWUxMzA0BQlSZXBvcnRVUkkFSkQ6XFBSSi5ORVRcV2ViUmVwb3J0czIwXFdlYlJlcG9ydHMuREFMXFJlcG9ydHNcVzJfNDMzN19SRVNfQllfQ1JFQVRJT04ucnB0BQpEZXNpZ25Nb2RlaAUHUmVmcmVzaGgFElBhZ2VSZXF1ZXN0Q29udGV4dBcEBRVJc0xhc3RQYWdlTnVtYmVyS25vd25nBQ5MYXN0UGFnZU51bWJlcgIFBQpQYWdlTnVtYmVyAgIFFEludGVyYWN0aXZlU29ydEluZm9zFClYU3lzdGVtLkJ5dGUsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OY0BAzwDPwN4A20DbAMgA3YDZQNyA3MDaQNvA24DPQMiAzEDLgMwAyIDPwM+Aw0DCgM8A0EDcgNyA2EDeQNPA2YDUwNvA3IDdANJA24DZgNvAyADeANtA2wDbgNzAzoDeANzA2kDPQMiA2gDdAN0A3ADOgMvAy8DdwN3A3cDLgN3AzMDLgNvA3IDZwMvAzIDMAMwAzEDLwNYA00DTANTA2MDaANlA20DYQMtA2kDbgNzA3QDYQNuA2MDZQMiAyADeANtA2wDbgNzAzoDeANzA2QDPQMiA2gDdAN0A3ADOgMvAy8DdwN3A3cDLgN3AzMDLgNvA3IDZwMvAzIDMAMwAzEDLwNYA00DTANTA2MDaANlA20DYQMiAyADLwM+BQlScHRTb3VyY2UFN0NyeXN0YWxEZWNpc2lvbnMuUmVwb3J0U291cmNlLk5vbkhUVFBDYWNoZWRSZXBvcnRTb3VyY2UFA2Nzc2U=", "rptAlbumOrder":["0"], "toolPanelType":"GroupTree", "toolPanelWidth":200, "toolPanelWidthUnit":"px", "iactParams":[{"paramName":"pFromDate", "description":"From Date", "valueDataType":"d", "value":[{"d":9, "m":4, "y":2014, "h":0, "min":0, "s":0, "ms":0}], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pToDate", "description":"To Date", "valueDataType":"d", "value":[{"d":9, "m":6, "y":2014, "h":0, "min":0, "s":0, "ms":0}], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pGroupBy", "description":"Group by", "valueDataType":"n", "value":[2], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"Boardtype"}, {"value":2, "desc":"Room type"}, {"value":3, "desc":"Rate Room type"}, {"value":4, "desc":"Rate code"}, {"value":5, "desc":"Guarantee code"}, {"value":6, "desc":"Adults"}, {"value":7, "desc":"Children"}, {"value":8, "desc":"Market code"}, {"value":9, "desc":"Source code"}, {"value":10, "desc":"Channel code"}, {"value":11, "desc":"Country"}, {"value":12, "desc":"Nationality"}, {"value":13, "desc":"Created by"}, {"value":14, "desc":"Adult+Child"}, {"value":15, "desc":"Agency"}, {"value":16, "desc":"Company"}, {"value":17, "desc":"Source"}, {"value":18, "desc":"Group"}, {"value":19, "desc":"Micros Discount"}, {"value":-1, "desc":"None"}], "defaultDisplayType":1}, {"paramName":"pDistributionBy", "description":"Distribution by", "valueDataType":"n", "value":[1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"RN"}, {"value":2, "desc":"ARR"}], "defaultDisplayType":1}, {"paramName":"pShowDetails", "description":"Show details", "valueDataType":"b", "value":[true], "allowCustomValue":false, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":true}, {"value":false}], "defaultDisplayType":1}, {"paramName":"pSubGroupBy", "description":"Sub Group", "valueDataType":"n", "value":[-1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"Boardtype"}, {"value":2, "desc":"Room type"}, {"value":3, "desc":"Rate Room type"}, {"value":4, "desc":"Rate code"}, {"value":5, "desc":"Guarantee code"}, {"value":6, "desc":"Adults"}, {"value":7, "desc":"Children"}, {"value":8, "desc":"Market code"}, {"value":9, "desc":"Source code"}, {"value":10, "desc":"Channel code"}, {"value":11, "desc":"Country"}, {"value":12, "desc":"Nationality"}, {"value":13, "desc":"Created by"}, {"value":14, "desc":"Adult+Child"}, {"value":15, "desc":"Agency"}, {"value":16, "desc":"Company"}, {"value":17, "desc":"Source"}, {"value":18, "desc":"Group"}, {"value":19, "desc":"Micros Discount"}, {"value":-1, "desc":"None"}], "defaultDisplayType":1}, {"paramName":"pIncludeDayUse", "description":"Include Day Use", "valueDataType":"b", "value":[true], "allowCustomValue":false, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":true}, {"value":false}], "defaultDisplayType":1}, {"paramName":"pDateType", "description":"Date Type", "valueDataType":"n", "value":[1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pCompHuse", "description":"Comp-Huse", "valueDataType":"n", "value":[0, 1, 2], "allowCustomValue":true, "allowMultiValue":true, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pOrderBy", "description":"Order By", "valueDataType":"n", "value":[2], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}], "paramOpts":{"numberFormat":{"groupSeperator":".", "decimalSeperator":","}, "dateFormat":"d.M.yyyy", "timeFormat":"H:mm:ss", "dateTimeFormat":"d.M.yyyy H:mm:ss", "booleanFormat":{"true":"True", "false":"False"}, "maxNumParameterDefaultValues":"200", "canOpenAdvancedDialog":true}, "zoom":100, "zoomFromUI":false, "lastRefresh":"9.7.2014 17:47:04"}, "curViewId":"0"}
viewer_toptoolbar_search_textField:Bul...
text_viewer_toptoolbar_selectPg:5
text_viewer_toptoolbar_zoom:100%
__CALLBACKID:viewer
__CALLBACKPARAM:{"tb":"gototext", "text":"5"}
Try to view New Page does not work. Request.Form parameters sample for that (try change page from page 2 to page 3):
__CRYSTALSTATEviewer:{"0":{"rptViewLabel":"Ana Rapor", "gpTreeCurrentExpandedPaths":{}, "vCtxt":"/wEXAwUVSXNMYXN0UGFnZU51bWJlcktub3duZwUOTGFzdFBhZ2VOdW1iZXICBQUKUGFnZU51bWJlcgIC", "pageNum":2}, "common":{"width":"100%", "Height":"100%", "enableDrillDown":true, "drillDownTarget":"_self", "printMode":"Pdf", "displayToolbar":true, "pageToTreeRatio":6, "pdfOCP":true, "promptingType":"html", "viewerState":"/wEXBAUkU3lzdGVtLldlYi5VSS5XZWJDb250cm9scy5XZWJDb250cm9sDxYGHgVXaWR0aBsAAAAAAABZQAcAAAAeBkhlaWdodBsAAAAAAABZQAcAAAAeBF8hU0ICgANkBQJodAUGX2JsYW5rBQ9SZXBvcnRWaWV3U3RhdGUXCAUDZHBpAngFB0lMT0lVSVNoBQdGYWN0b3J5BZYBQ3J5c3RhbERlY2lzaW9ucy5SZXBvcnRTb3VyY2UuUmVwb3J0U291cmNlRmFjdG9yeSxDcnlzdGFsRGVjaXNpb25zLlJlcG9ydFNvdXJjZSwgVmVyc2lvbj0xMy4wLjIwMDAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj02OTJmYmVhNTUyMWUxMzA0BQlSZXBvcnRVUkkFSkQ6XFBSSi5ORVRcV2ViUmVwb3J0czIwXFdlYlJlcG9ydHMuREFMXFJlcG9ydHNcVzJfNDMzN19SRVNfQllfQ1JFQVRJT04ucnB0BQpEZXNpZ25Nb2RlaAUHUmVmcmVzaGgFElBhZ2VSZXF1ZXN0Q29udGV4dBcEBRVJc0xhc3RQYWdlTnVtYmVyS25vd25nBQ5MYXN0UGFnZU51bWJlcgIFBQpQYWdlTnVtYmVyAgIFFEludGVyYWN0aXZlU29ydEluZm9zFClYU3lzdGVtLkJ5dGUsIG1zY29ybGliLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OY0BAzwDPwN4A20DbAMgA3YDZQNyA3MDaQNvA24DPQMiAzEDLgMwAyIDPwM+Aw0DCgM8A0EDcgNyA2EDeQNPA2YDUwNvA3IDdANJA24DZgNvAyADeANtA2wDbgNzAzoDeANzA2kDPQMiA2gDdAN0A3ADOgMvAy8DdwN3A3cDLgN3AzMDLgNvA3IDZwMvAzIDMAMwAzEDLwNYA00DTANTA2MDaANlA20DYQMtA2kDbgNzA3QDYQNuA2MDZQMiAyADeANtA2wDbgNzAzoDeANzA2QDPQMiA2gDdAN0A3ADOgMvAy8DdwN3A3cDLgN3AzMDLgNvA3IDZwMvAzIDMAMwAzEDLwNYA00DTANTA2MDaANlA20DYQMiAyADLwM+BQlScHRTb3VyY2UFN0NyeXN0YWxEZWNpc2lvbnMuUmVwb3J0U291cmNlLk5vbkhUVFBDYWNoZWRSZXBvcnRTb3VyY2UFA2Nzc2U=", "rptAlbumOrder":["0"], "toolPanelType":"GroupTree", "toolPanelWidth":200, "toolPanelWidthUnit":"px", "iactParams":[{"paramName":"pFromDate", "description":"From Date", "valueDataType":"d", "value":[{"d":9, "m":4, "y":2014, "h":0, "min":0, "s":0, "ms":0}], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pToDate", "description":"To Date", "valueDataType":"d", "value":[{"d":9, "m":6, "y":2014, "h":0, "min":0, "s":0, "ms":0}], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pGroupBy", "description":"Group by", "valueDataType":"n", "value":[2], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"Boardtype"}, {"value":2, "desc":"Room type"}, {"value":3, "desc":"Rate Room type"}, {"value":4, "desc":"Rate code"}, {"value":5, "desc":"Guarantee code"}, {"value":6, "desc":"Adults"}, {"value":7, "desc":"Children"}, {"value":8, "desc":"Market code"}, {"value":9, "desc":"Source code"}, {"value":10, "desc":"Channel code"}, {"value":11, "desc":"Country"}, {"value":12, "desc":"Nationality"}, {"value":13, "desc":"Created by"}, {"value":14, "desc":"Adult+Child"}, {"value":15, "desc":"Agency"}, {"value":16, "desc":"Company"}, {"value":17, "desc":"Source"}, {"value":18, "desc":"Group"}, {"value":19, "desc":"Micros Discount"}, {"value":-1, "desc":"None"}], "defaultDisplayType":1}, {"paramName":"pDistributionBy", "description":"Distribution by", "valueDataType":"n", "value":[1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"RN"}, {"value":2, "desc":"ARR"}], "defaultDisplayType":1}, {"paramName":"pShowDetails", "description":"Show details", "valueDataType":"b", "value":[true], "allowCustomValue":false, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":true}, {"value":false}], "defaultDisplayType":1}, {"paramName":"pSubGroupBy", "description":"Sub Group", "valueDataType":"n", "value":[-1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":1, "desc":"Boardtype"}, {"value":2, "desc":"Room type"}, {"value":3, "desc":"Rate Room type"}, {"value":4, "desc":"Rate code"}, {"value":5, "desc":"Guarantee code"}, {"value":6, "desc":"Adults"}, {"value":7, "desc":"Children"}, {"value":8, "desc":"Market code"}, {"value":9, "desc":"Source code"}, {"value":10, "desc":"Channel code"}, {"value":11, "desc":"Country"}, {"value":12, "desc":"Nationality"}, {"value":13, "desc":"Created by"}, {"value":14, "desc":"Adult+Child"}, {"value":15, "desc":"Agency"}, {"value":16, "desc":"Company"}, {"value":17, "desc":"Source"}, {"value":18, "desc":"Group"}, {"value":19, "desc":"Micros Discount"}, {"value":-1, "desc":"None"}], "defaultDisplayType":1}, {"paramName":"pIncludeDayUse", "description":"Include Day Use", "valueDataType":"b", "value":[true], "allowCustomValue":false, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[{"value":true}, {"value":false}], "defaultDisplayType":1}, {"paramName":"pDateType", "description":"Date Type", "valueDataType":"n", "value":[1], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pCompHuse", "description":"Comp-Huse", "valueDataType":"n", "value":[0, 1, 2], "allowCustomValue":true, "allowMultiValue":true, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}, {"paramName":"pOrderBy", "description":"Order By", "valueDataType":"n", "value":[2], "allowCustomValue":true, "allowMultiValue":false, "allowRangeValue":false, "allowDiscreteValue":true, "isEditable":true, "usage":25, "isDataFetching":false, "attributes":{"IsDCP":false}, "isOptionalPrompt":false, "allowNullValue":false, "defaultValues":[], "defaultDisplayType":1}], "paramOpts":{"numberFormat":{"groupSeperator":".", "decimalSeperator":","}, "dateFormat":"d.M.yyyy", "timeFormat":"H:mm:ss", "dateTimeFormat":"d.M.yyyy H:mm:ss", "booleanFormat":{"true":"True", "false":"False"}, "maxNumParameterDefaultValues":"200", "canOpenAdvancedDialog":true}, "zoom":100, "zoomFromUI":false, "lastRefresh":"9.7.2014 17:47:04"}, "curViewId":"0"}
viewer_toptoolbar_search_textField:Bul...
text_viewer_toptoolbar_selectPg:2 / 5
text_viewer_toptoolbar_zoom:100%
__CALLBACKID:viewer
__CALLBACKPARAM:{"tb":"next"} -
Hi,
I am a new bie to JSF and also Jasper Reports.
I Have created a JSF page where by passing fromDate and toDate from UI passed as a parameter to Jasperreport to generate a report.
Report is generated as a pdf but my requirement is i want to view the pdf in the browser.
I used with runReportToPdf(), but with this i dont no how to get the servletConfig whereby in some code i got the code to get the servletConfig and servletContext and passing the .jasper file to convert it as a inputStream or a File.
I think this is not the proper way to view the things in browser bcoz i want to show the Excel and CSV report also in the browser.
Could anyone Pls help me in this. Is there any other way to do this.
My Code:
<code>
public void execute()
try
FacesContext context = FacesContext.getCurrentInstance();
Object ObjTest = context.getExternalContext().getSessionMap().get("awardCodeMast");
AwardCodeMast aObj = (AwardCodeMast)ObjTest;
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date fromDate1 = aObj.getEffectiveFromDate();
String s1 = df.format(fromDate1);
System.out.println("#####################"+s1);
Date toDate1 = aObj.getEffectiveToDate();
String s2 = df.format(toDate1);
System.out.println("#####################"+s2);
// Started with Jasper Reports
JasperReport jasperReport;
JasperPrint jasperPrint;
JRResultSetDataSource obj;
JasperDesign jasperDesign;
JRDataSource jr1;
String fromDate = s1;
String toDate = s2;
Class.forName("com.mysql.jdbc.Driver");
Connection con1=DriverManager.getConnection("jdbc:mysql://HARUNS-ATHITHI.ITCINFOTECH.COM/pba","root","root");
Statement stmt1=con1.createStatement();
Map<String, Serializable> parameters = new HashMap<String, Serializable>();
parameters.put("fromDate", fromDate);
parameters.put("toDate", toDate);
System.out.println("Put...........");
String ss = context.getExternalContext().getRequestServletPath();
System.out.println("SS : "+ss+"...............");
byte[] bytes = null;
ServletOutputStream outstream = null;
InputStream reportStream = context.getExternalContext().getResourceAsStream("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jasper");
HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
outstream = response.getOutputStream();
ExternalContext extContext = context.getExternalContext();
ServletContext servletContext = (ServletContext) extContext.getContext();
File reportFile = new File("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jasper");
jasperDesign = JasperManager.loadXmlDesign("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jrxml");
System.out.println("1..................");
jasperReport = JasperCompileManager.compileReport(jasperDesign);
System.out.println("2...................");
JasperRunManager.runReportToPdfStream(reportStream, outstream, parameters, con1);
jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, con1);
System.out.println("3...............");
String ss1 = (String)context.getExternalContext().getRequestPathInfo();
System.out.println(ss1+"............................");
System.out.println("Report generated....................");
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
System.out.println("Setting content type..................");
System.out.println("getting output Stream...........");
response.setContentLength(bytes.length);
System.out.println("setting the context length...........");
JasperRunManager.runReportToPdfStream(reportStream, outstream,parameters, con1);
//outstream.write(bytes);
System.out.println("writing byte array.............");
outstream.flush();
System.out.println("flushing out..............");
outstream.close();
ret_sta = "Success";
}catch(Exception e){System.out.println(e);}
System.out.println(ret_sta+".....................");
FacesContext context = FacesContext.getCurrentInstance();
context.responseComplete();
</code>
Kindly help me, i would be very thankful to u.
Thanks,
Ambika.Hi,
I want to display a pdf through a web browser. I got it to work with my one report but my other one do not want to work.
Here is my code.
public void executeShiftReport(Calendar dateOfReport) {
try {
Calendar calMrng = new GregorianCalendar(dateOfReport.get(Calendar.YEAR), dateOfReport.get(Calendar.MONTH), dateOfReport.get(Calendar.DAY_OF_MONTH), 06, 00);
Date reportDate = dateOfReport.getTime();
Date dateMrng = calMrng.getTime();
JasperPrint jasperPrint;
Connection conn = establishConnection();
//the paramaters of the report will be saved within the hashmap
HashMap jasParam = new HashMap();
jasParam.put("fromDateMorning", new Timestamp(dateMrng.getTime()));
jasParam.put("Date", reportDate);
// adds 1 day to the calender to get tomorrows date for night shift ending
calMrng.add(Calendar.DAY_OF_MONTH, 1);
Date dateMoreMrng = calMrng.getTime();
jasParam.put("toDateMorning", new Timestamp(dateMoreMrng.getTime()));
File file = new File("E:/Projects/BranSystems Internal/BranSupportLog/reports/");
jasperPrint = JasperFillManager.fillReport(new FileInputStream(new File(file, "morningShift.jasper")), jasParam, conn);
// JasperExportManager.exportReportToPdf(jasperPrint);
// JasperExportManager.exportReportToHtmlFile(jasperPrint, "E:/Projects/BranSystems Internal/BranSupportLog/reports/morningShift.html");
byte[] bytes = JasperExportManager.exportReportToPdf(jasperPrint);
FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
// let the pdf display in the same window with 'inline',
response.setHeader("Content-disposition", "inline;filename=morningShift.pdf;");
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
response.getOutputStream().write(bytes);
response.flushBuffer();
context.responseComplete();
} catch (JRException ex) {
Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
} catch (FileNotFoundException ex) {
Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
} -
Language problems with std reports
Dears gurus,
We are facing some problems with standard reports due to translations...
We have 4 languages actives at our ERP System, DE, EN, ES and PT... The completation Language is EN in all cases...
The SMLT Import Logs for both languages (ES and PT) and completation with EN are not showing errors, but if we import at last the Language ES, the reports runs OK with logon language ES but with PT as logon language all texts are showed in DE, even that the completatin language is EN. If we re import PT language the reports runs OK with logon language PT but with ES as logon language all texts are showed in DE...
Had anyone faced the same problem and solve it?
Thanx a lot!!!Garth, we found that the reports with problem was created or provided by SAP trough Report Painter or Report Writer.
We can solve the problem recreating the "Report Group" in the logon languaje that works bad. To do this you have to find in which Report Group is the Report that you are running and using transaction GR52 complete attributes for this group, save (Logged in with the language that shows the problem) and the problem is solved.
I hope this helps you.
Thanx
Regards
MJ -
Probleme with crystal report : a report with 3 levels
hello...
please am a from france, i have a bad english so is there somme one how speak frensh, i have a probleme with crystal report...
so my first report, i have an XML file xith contine a lotof data, ils with a lot of level so i want that you show me how can i reprensent that, i can give u my wml file and also a word file to explain you what do i want comme result..
so i have donwload an evaluation version of crystal report...
thaks for uHi alpacino,
I know a really good actor that has the same name...and you're new to reports...hmmmmmmmm.....well, first of all,
bravo to you for being able to write english at all. I'm glad I don't have to learn it again.
Go to the Group Expert and select one of your "levels".
This will be your top group. Then select the next "level", etc.
I know you're not a dummy, but get a "Crystal Reports for Dummies" book and then a Crystal Reference book. The dummy books are actually pretty good and give you a "from the ground" start. Then keep coming back to the forum and test out your ideas by helping others.
Hope this helps,
The Panda -
hi
I am using Jasper & after compilation I got following exception
.net.sf.jaspereports.engine.JRException : Invalid byte 1 of 1-byte UTF-8 sequences.
would anybody tell me how to soilve this problem. I think it is error of Xml fileI am facing the same problem with jasper reprots, did u find the solution
please let me know,
i am using jdk 1.4 and the ide eclipse version 3.2
any help will be greatly appreciated
thanks -
Problems with activity reports on Enterprise Portal
Hello, we have problems with activity reports on Enterprise Portal. It shows only zeros since certain date.
We have this error in monitoring of Activity Reports - Status of Activity Reporting: "The database contains non-aggregated data that is more than 2 hours old".
And we found this exception in logs: "Exception during a Prepared-statement DB update"
What could be a problem? What should we do?
Thank you.Configurarion of the Data Collection Service is done well, I think:
Activate portal activity report: true
First day of the week (e.g., Sunday or Monday): Monday
Gather iView statistics:true
Gather page statistics:true
Gather statistics for remote users of local content (global portal): true
Number of days for daily data retention: 90
Number of days for hourly data retention: 30
Number of days for monthly data retention: 730
Number of days for quarterly data retention: 1460
Number of days for weekly data retention: 365
Objects to exclude from reports
Pages for which to gather user data
Save interval (minutes): 60
What should we do then? -
hi ia have one java Frame in which i enter the no.and according to number it ghenereate report from data base.using jasper report
i have one test.jar and one test.jrxml file for jasper report
how can i start jasper report with jnlphi ia have one java Frame in which i enter the no.and
according to number it ghenereate report from data
base.using jasper reportEither Jasper reports will need to be 'installed',
or it will need to have its classes on the application's
runtime classpath. The last one is probably the
better strategy, but the first is also possible, using
a (web start) installer (element).
Can you run this from the command line?
If so, what exact command do you use to run it?
i have one test.jar and one test.jrxml file How does the code load the .jrxml file?
A File("test.jrxml") approach would be a
problem for web start.
The best way is to put it also on the application's
classpath (probably by putting it in a Jar it and
adding the jar to the classpath), then use getResource()
to get an URL pointing to it.
..for
jasper report
how can i start jasper report with jnlpThen there is the question of whether the DB
and JNLP will be coming from the same server,
which means the code can be sandboxed, or
whether it requires code signing and extended
permissions.
What does the frame do with the report once it
is generated? Is it written to disk, or printed?
This question breaks down to many parts.
Message was edited by:
AndrewThompson64 -
Problem with jasper. Help needed urgently!
Hi everybody. I'm trying to run jasper reports in a new web applicattion i've done. The problem is that the jasper runs perfectly in my pc i've developed the apllicattion but it doesn't work in the server. The error message that I show is:
[Error de servlet]-[net/sf/jasperreports/engine/fill/JRVerticalFiller]: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/fill/JRVerticalFiller
java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:85)
java/lang/Error.<init>(Ljava/lang/String;)V+1 (Error.java:41)
java/lang/NoClassDefFoundError.<init>(Ljava/lang/String;)V+1 (NoClassDefFoundError.java:38)
net/sf/jasperreports/engine/fill/JRFiller.createFiller(Lnet/sf/jasperreports/engine/JasperReport;)Lnet/sf/jasperreports/engine/fill/JRBaseFiller;+44 (JRFiller.java:147)
net/sf/jasperreports/engine/fill/JRFiller.fillReport(Lnet/sf/jasperreports/engine/JasperReport;Ljava/util/Map;Ljava/sql/Connection;)Lnet/sf/jasperreports/engine/JasperPrint;+1 (JRFiller.java:57)
net/sf/jasperreports/engine/JasperFillManager.fillReport(Lnet/sf/jasperreports/engine/JasperReport;Ljava/util/Map;Ljava/sql/Connection;)Lnet/sf/jasperreports/engine/JasperPrint;+3 (JasperFillManager.java:402)
org/apache/jsp/_listado_5F_jasper._jspService(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+503 (_listado_5F_jasper.java:173)
com/ibm/ws/webcontainer/jsp/runtime/HttpJspBase.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (HttpJspBase.java:89)
javax/servlet/http/HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (HttpServlet.java:848)
com/ibm/ws/webcontainer/jsp/servlet/JspServlet$JspServletWrapper.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Z)V+225 (JspServlet.java:396)
com/ibm/ws/webcontainer/jsp/servlet/JspServlet.serviceJspFile(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljava/lang/String;Ljava/lang/Throwable;ZLjava/lang/String;)V+97 (JspServlet.java:880)
com/ibm/ws/webcontainer/jsp/servlet/JspServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+352 (JspServlet.java:978)
javax/servlet/http/HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (HttpServlet.java:848)
com/ibm/ws/webcontainer/servlet/StrictServletInstance.doService(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (StrictServletInstance.java:105)
com/ibm/ws/webcontainer/servlet/StrictLifecycleServlet._service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (StrictLifecycleServlet.java:160)
com/ibm/ws/webcontainer/servlet/IdleServletState.service(Lcom/ibm/ws/webcontainer/servlet/StrictLifecycleServlet;Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (StrictLifecycleServlet.java:313)
com/ibm/ws/webcontainer/servlet/StrictLifecycleServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (StrictLifecycleServlet.java:116)
com/ibm/ws/webcontainer/servlet/ServletInstance.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lcom/ibm/ws/webcontainer/webapp/WebAppServletInvocationEvent;)V+0 (ServletInstance.java:250)
com/ibm/ws/webcontainer/servlet/ValidServletReferenceState.dispatch(Lcom/ibm/ws/webcontainer/servlet/ServletInstanceReference;Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lcom/ibm/ws/webcontainer/webapp/WebAppServletInvocationEvent;)V+0 (ValidServletReferenceState.java:42)
com/ibm/ws/webcontainer/servlet/ServletInstanceReference.dispatch(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lcom/ibm/ws/webcontainer/webapp/WebAppServletInvocationEvent;)V+0 (ServletInstanceReference.java:40)
com/ibm/ws/webcontainer/webapp/WebAppRequestDispatcher.handleWebAppDispatch(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (WebAppRequestDispatcher.java:936)
com/ibm/ws/webcontainer/webapp/WebAppRequestDispatcher.dispatch(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Z)V+0 (WebAppRequestDispatcher.java:268)
com/ibm/ws/webcontainer/webapp/WebAppRequestDispatcher.forward(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (WebAppRequestDispatcher.java:155)
org/apache/struts/action/RequestProcessor.doForward(Ljava/lang/String;Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (RequestProcessor.java:1058)
org/apache/struts/action/RequestProcessor.processForwardConfig(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Lorg/apache/struts/config/ForwardConfig;)V+0 (RequestProcessor.java:428)
org/apache/struts/action/RequestProcessor.process(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (RequestProcessor.java:217)
org/apache/struts/action/ActionServlet.process(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (ActionServlet.java:1481)
org/apache/struts/action/ActionServlet.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (ActionServlet.java:525)
javax/servlet/http/HttpServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (HttpServlet.java:733)
javax/servlet/http/HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (HttpServlet.java:848)
com/ibm/ws/webcontainer/servlet/StrictServletInstance.doService(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (StrictServletInstance.java:105)
com/ibm/ws/webcontainer/servlet/StrictLifecycleServlet._service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (StrictLifecycleServlet.java:160)
com/ibm/ws/webcontainer/servlet/IdleServletState.service(Lcom/ibm/ws/webcontainer/servlet/StrictLifecycleServlet;Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (StrictLifecycleServlet.java:313)
com/ibm/ws/webcontainer/servlet/StrictLifecycleServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (StrictLifecycleServlet.java:116)
com/ibm/ws/webcontainer/servlet/ServletInstance.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lcom/ibm/ws/webcontainer/webapp/WebAppServletInvocationEvent;)V+0 (ServletInstance.java:250)
com/ibm/ws/webcontainer/servlet/ValidServletReferenceState.dispatch(Lcom/ibm/ws/webcontainer/servlet/ServletInstanceReference;Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lcom/ibm/ws/webcontainer/webapp/WebAppServletInvocationEvent;)V+0 (ValidServletReferenceState.java:42)
com/ibm/ws/webcontainer/servlet/ServletInstanceReference.dispatch(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lcom/ibm/ws/webcontainer/webapp/WebAppServletInvocationEvent;)V+0 (ServletInstanceReference.java:40)
com/ibm/ws/webcontainer/webapp/WebAppRequestDispatcher.handleWebAppDispatch(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (WebAppRequestDispatcher.java:936)
com/ibm/ws/webcontainer/webapp/WebAppRequestDispatcher.dispatch(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Z)V+0 (WebAppRequestDispatcher.java:268)
com/ibm/ws/webcontainer/webapp/WebAppRequestDispatcher.forward(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+0 (WebAppRequestDispatcher.java:155)
com/ibm/ws/webcontainer/srt/WebAppInvoker.doForward(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (WebAppInvoker.java:79)
com/ibm/ws/webcontainer/srt/WebAppInvoker.handleInvocationHook(Ljava/lang/Object;)V+0 (WebAppInvoker.java:159)
com/ibm/ws/webcontainer/cache/invocation/CachedInvocation.handleInvocation(Ljava/lang/Object;)V+0 (CachedInvocation.java:66)
com/ibm/ws/webcontainer/srp/ServletRequestProcessor.dispatchByURI(Ljava/lang/String;Lcom/ibm/ws/webcontainer/srp/ISRPConnection;)V+0 (ServletRequestProcessor.java:126)
com/ibm/ws/webcontainer/oselistener/OSEListenerDispatcher.service(Lcom/ibm/ws/webcontainer/oselistener/api/IOSEConnection;)V+0 (OSEListener.java:317)
com/ibm/ws/webcontainer/http/HttpConnection.handleRequest()V+0 (HttpConnection.java:56)
com/ibm/ws/http/HttpConnection.readAndHandleRequest(Z)V+0 (HttpConnection.java:575)
com/ibm/ws/http/HttpConnection.run()V+0 (HttpConnection.java:375)
com/ibm/ws/util/ThreadPool$Worker.run()V+0 (ThreadPool.java:654)
I'm running the applicattion with jasperreports1.2.2.jar and the other needed libraries as it's explained in sourceforge.
Should I have missed any .jar? What's the problem? Why the applicattion runs perfectly in my pc but doesn't run in the server?Yes, because if i hadn't put each and every library required in WEBINF/lib it hadn't work in my pc. There is something in the server different but i don't know what it is. The ear file i export contains the libraries required in the places that they're needed.
Maybe you are looking for
-
My new tab page disappeared how do i get it back?
My new tab page disappeared. How do i get it back? When i click on "new tab +", i get a search screen that looks similar to google search page.
-
IPad doesn't receive all text messages
iPad doesn't receive all text messages
-
I'm very surprised that it isn't possible to look a bought dvd via airplay on apple TV. In the shop they told everything what you look on the imac you can mirror via airplay and apple tv on a tvscreen or beamer! But it doesn't work with a simple movi
-
Security error on ff launch. can not open https sites.
I have to use IE to see most of my sites. When I launch Fire Fox, an error pops up. "Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that th
-
I have a macbook air and i have it hooked to another monitor and I love it but lately it has after it goes to sleep for a while it sounds like it is trying to run the drive or fan really hard and when I try to bring it alive it does not come back to