本文整理汇总了Java中net.sf.jasperreports.engine.JRException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java JRException.printStackTrace方法的具体用法?Java JRException.printStackTrace怎么用?Java JRException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.JRException
的用法示例。
在下文中一共展示了JRException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printPagePartePDF
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
private void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars,
String strcOrderId) throws IOException, ServletException {
if (log4j.isDebugEnabled())
log4j.debug("Output: pdf");
String strLanguage = vars.getLanguage();
String strBaseDesign = getBaseDesignPath(strLanguage);
HashMap<String, Object> parameters = new HashMap<String, Object>();
JasperReport jasperReportLines;
try {
jasperReportLines = ReportingUtils.compileReport(strBaseDesign
+ "/org/openbravo/erpReports/RptC_OrderPO_Lines.jrxml");
} catch (JRException e) {
e.printStackTrace();
throw new ServletException(e.getMessage());
}
parameters.put("SR_LINES", jasperReportLines);
parameters.put("ORDER_ID", strcOrderId);
renderJR(vars, response, null, "pdf", parameters, null, null);
}
示例2: printPagePartePDF
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
private void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars,
String strmRequisitionId) throws IOException, ServletException {
if (log4j.isDebugEnabled())
log4j.debug("Output: pdf");
String strBaseDesign = getBaseDesignPath(vars.getLanguage());
HashMap<String, Object> parameters = new HashMap<String, Object>();
JasperReport jasperReportLines;
try {
jasperReportLines = ReportingUtils.compileReport(strBaseDesign
+ "/org/openbravo/erpReports/RptM_Requisition_Lines.jrxml");
} catch (JRException e) {
e.printStackTrace();
throw new ServletException(e.getMessage());
}
parameters.put("SR_LINES", jasperReportLines);
parameters.put("REQUISITION_ID", strmRequisitionId);
renderJR(vars, response, null, "pdf", parameters, null, null);
}
示例3: printPagePartePDF
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
private void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars,
String strClave) throws IOException, ServletException {
if (log4j.isDebugEnabled())
log4j.debug("Output: pdf - ID:" + strClave);
RptCProposalJrData[] data = RptCProposalJrData.select(this, strClave,
Utility.getContext(this, vars, "#User_Client", "RptC_ProposalJr"),
Utility.getContext(this, vars, "#AccessibleOrgTree", "RptC_ProposalJr"));
String strLanguage = vars.getLanguage();
String strBaseDesign = getBaseDesignPath(strLanguage);
JasperReport jasperReportLines;
try {
jasperReportLines = ReportingUtils.compileReport(strBaseDesign
+ "/org/openbravo/erpReports/SubreportLines.jrxml");
} catch (JRException e) {
e.printStackTrace();
throw new ServletException(e.getMessage());
}
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("SR_LINES", jasperReportLines);
String strOutput = "pdf";
String strReportName = "@[email protected]/org/openbravo/erpReports/RptC_ProposalJr.jrxml";
renderJR(vars, response, strReportName, strOutput, parameters, data, null);
}
示例4: print
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
/**
*
*/
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
if (Thread.currentThread().isInterrupted())
{
throw new PrinterException("Current thread interrupted.");
}
pageIndex += pageOffset;
if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
{
return Printable.NO_SUCH_PAGE;
}
try
{
JRGraphics2DExporter exporter = new JRGraphics2DExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
exporter.exportReport();
}
catch (JRException e)
{
e.printStackTrace();
throw new PrinterException(e.getMessage());
}
return Printable.PAGE_EXISTS;
}
示例5: printPagePDF
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
private void printPagePDF(HttpServletResponse response, VariablesSecureApp vars,
String strcRemittanceId, String language) throws IOException, ServletException {
if (log4j.isDebugEnabled())
log4j.debug("Output: pdf");
String strBaseDesign = getBaseDesignPath(language);
String strOutput = new String("pdf");
String strReportName = "@[email protected]/org/openbravo/erpReports/RptC_Remittance.jrxml";
if (strOutput.equals("pdf"))
response.setHeader("Content-disposition", "inline; filename=RptC_Remittance.pdf");
RptCRemittanceData[] data = RptCRemittanceData
.select(this, Utility.getContext(this, vars, "#User_Client", "RptC_RemittanceJR"),
Utility.getContext(this, vars, "#AccessibleOrgTree", "RptC_RemittanceJR"),
strcRemittanceId);
JasperReport jasperReportLines;
try {
jasperReportLines = ReportingUtils.getTranslatedJasperReport(this, strBaseDesign
+ "/org/openbravo/erpReports/RptC_Remittance_Lines.jrxml", vars.getLanguage(),
strBaseDesign);
} catch (JRException e) {
e.printStackTrace();
throw new ServletException(e.getMessage());
}
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("LANGUAGE", language);
parameters.put("SR_LINES", jasperReportLines);
renderJR(vars, response, strReportName, strOutput, parameters, data, null);
}
示例6: btnReloadActionPerformed
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
void btnReloadActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnReloadActionPerformed
{//GEN-HEADEREND:event_btnReloadActionPerformed
// Add your handling code here:
if (type == TYPE_FILE_NAME)
{
try
{
loadReport(reportFileName, isXML);
}
catch (JRException e)
{
e.printStackTrace();
jasperPrint = null;
setPageIndex(0);
refreshPage();
JOptionPane.showMessageDialog(this, getBundleString("error.loading"));
}
forceRefresh();
}
}
示例7: saveReport
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
private void saveReport(Report report, JasperPrint jasperPrint) {
String separator = "";
if (!report.getTargetDirectory().toString().endsWith("/")) {
separator = "/";
}
final String target = report.getTargetDirectory() + separator + report.getFilename();
try {
ReportingUtils.saveReport(jasperPrint, ExportType.PDF, null, new File(target));
} catch (final JRException e) {
e.printStackTrace();
}
}
示例8: doPost
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException,
ServletException {
VariablesSecureApp vars = new VariablesSecureApp(request);
String strTabId = vars.getRequiredStringParameter("inpTabId");
String strWindowId = vars.getRequiredStringParameter("inpWindowId");
String strAccessLevel = vars.getRequiredStringParameter("inpAccessLevel");
if (log4j.isDebugEnabled())
log4j.debug("Export grid, tabID: " + strTabId);
ServletOutputStream os = null;
InputStream is = null;
String strLanguage = vars.getLanguage();
String strBaseDesign = getBaseDesignPath(strLanguage);
String fileName = "";
if (log4j.isDebugEnabled())
log4j.debug("*********************Base design path: " + strBaseDesign);
try {
GridReportVO gridReportVO = createGridReport(vars, strTabId, strWindowId, strAccessLevel,
vars.commandIn("EXCEL"));
os = response.getOutputStream();
is = getInputStream(strBaseDesign + "/org/openbravo/erpCommon/utility/"
+ gridReportVO.getJrxmlTemplate());
if (log4j.isDebugEnabled())
log4j.debug("Create report, type: " + vars.getCommand());
UUID reportId = UUID.randomUUID();
String strOutputType = vars.getCommand().toLowerCase();
if (strOutputType.equals("excel")) {
strOutputType = "xls";
}
fileName = "ExportGrid-" + (reportId) + "." + strOutputType;
if (vars.commandIn("HTML"))
GridBO.createHTMLReport(is, gridReportVO, globalParameters.strFTPDirectory, fileName);
else if (vars.commandIn("PDF")) {
GridBO.createPDFReport(is, gridReportVO, globalParameters.strFTPDirectory, fileName);
} else if (vars.commandIn("EXCEL")) {
GridBO.createXLSReport(is, gridReportVO, globalParameters.strFTPDirectory, fileName);
} else if (vars.commandIn("CSV")) {
GridBO.createCSVReport(is, gridReportVO, globalParameters.strFTPDirectory, fileName);
}
printPagePopUpDownload(os, fileName);
} catch (JRException e) {
e.printStackTrace();
throw new ServletException(e.getMessage());
} catch (IOException ioe) {
try {
FileUtility f = new FileUtility(globalParameters.strFTPDirectory, fileName, false, true);
if (f.exists())
f.deleteFile();
} catch (IOException ioex) {
log4j.error("Error trying to delete temporary report file " + fileName + " : "
+ ioex.getMessage());
}
} finally {
is.close();
os.close();
}
}
示例9: printPagePDF
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
private void printPagePDF(HttpServletResponse response, VariablesSecureApp vars,
String strDateFrom, String strDateTo, String strRawMaterial) throws IOException,
ServletException {
if (log4j.isDebugEnabled())
log4j.debug("Output: Jasper Report : Production Report");
String strReportName = "@[email protected]/org/openbravo/erpCommon/ad_reports/productionReport.jrxml";
response.setHeader("Content-disposition", "inline; filename=ProductionReportJR.pdf");
String strTitle = "Production Report";
String strSubTitle = Utility.messageBD(this, "From", vars.getLanguage()) + " " + strDateFrom
+ " " + Utility.messageBD(this, "To", vars.getLanguage()) + " " + strDateTo;
// String strSubTitle = (!strDateFrom.equals("")?"From "+strDateFrom:"")
// + (!strDateTo.equals("")?" to "+strDateTo:"");
if (!strRawMaterial.equals("Y"))
strRawMaterial = "N";
ReportProductionData[] data = ReportProductionData.select(this, strRawMaterial,
Utility.getContext(this, vars, "#User_Client", "ReportProductionJR"),
Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportProductionJR"), strDateFrom,
DateTimeData.nDaysAfter(this, strDateTo, "1"));
if (data == null || data.length == 0) {
data = ReportProductionData.set();
}
HashMap<String, Object> parameters = new HashMap<String, Object>();
if (log4j.isDebugEnabled())
log4j.debug("inpDateFrom:"
+ vars.getRequestGlobalVariable("inpDateFrom", "ReportProductionJR|DateFrom"));
if (log4j.isDebugEnabled())
log4j.debug("inpDateTo:"
+ vars.getRequestGlobalVariable("inpDateTo", "ReportProductionJR|DateFrom"));
String strLanguage = vars.getLanguage();
String strBaseDesign = getBaseDesignPath(strLanguage);
JasperReport jasperReportLines;
try {
jasperReportLines = ReportingUtils.compileReport(strBaseDesign
+ "/org/openbravo/erpCommon/ad_reports/productionSubReport.jrxml");
} catch (JRException e) {
e.printStackTrace();
throw new ServletException(e.getMessage());
}
parameters.put("SR_LINES", jasperReportLines);
parameters.put("REPORT_TITLE", strTitle);
parameters.put("REPORT_SUBTITLE", strSubTitle);
try {
if (!strDateFrom.equals(""))
parameters.put("DATE_FROM", new SimpleDateFormat("dd-MM-yyyy").parse(strDateFrom));
if (!strDateTo.equals(""))
parameters.put("DATE_TO", new SimpleDateFormat("dd-MM-yyyy").parse(strDateTo));
} catch (Exception ex) {
throw new ServletException(ex);
}
if (log4j.isDebugEnabled())
log4j.debug("parameters: " + parameters.toString());
if (log4j.isDebugEnabled())
log4j.debug("data: " + data);
renderJR(vars, response, strReportName, "pdf", parameters, data, null);
}
示例10: printPagePartePDF
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
private void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars,
String strcOrderId) throws IOException, ServletException {
if (log4j.isDebugEnabled())
log4j.debug("Output: RptC_Order - pdf");
RptCOrderHeaderData[] data = RptCOrderHeaderData.select(this, strcOrderId);
if (log4j.isDebugEnabled())
log4j.debug("data: " + (data == null ? "null" : "not null"));
if (data == null || data.length == 0)
data = RptCOrderHeaderData.set();
String strLanguage = vars.getLanguage();
String strBaseDesign = getBaseDesignPath(strLanguage);
JasperReport jasperReportLines;
try {
jasperReportLines = ReportingUtils.compileReport(strBaseDesign
+ "/org/openbravo/erpReports/C_OrderLinesJR.jrxml");
} catch (JRException e) {
e.printStackTrace();
throw new ServletException(e.getMessage());
}
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("SR_LINES", jasperReportLines);
response.setHeader("Content-disposition", "inline; filename=SalesOrderJR.pdf");
String strReportName = "@[email protected]/org/openbravo/erpReports/C_OrderJR.jrxml";
renderJR(vars, response, strReportName, "pdf", parameters, data, null);
}
示例11: setPrint
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
public static JasperPrint setPrint(Date start, Date end)
throws IOException {
Map<String, Object> params = new HashMap<String, Object>(5);
if (start == null) {
end = Utils.setMaxDate(end);
start = Utils.setMinDate(end);
} else if (end == null) {
end = Utils.setMaxDate(start);
start = Utils.setMinDate(start);
} else {
start = Utils.setMinDate(start);
end = Utils.setMaxDate(end);
}
params.put("begdate", Utils.toLocaleDate(start));
params.put("enddate", Utils.toLocaleDate(end));
PictureBooksReportCommand pictureBooks = new PictureBooksReportCommand(start, end);
pictureBooks = (PictureBooksReportCommand)Cirkulacija.getApp().getService().executeCommand(pictureBooks);
List l= pictureBooks.getList();
Object[] row = (Object[])l.get(0);
params.put("users", ((Long)row[0]).toString());
params.put("lend", ((Long)row[1]).toString());
params.put("return", ((Long)row[2]).toString());
try {
JasperPrint jp = JasperFillManager.fillReport(Picturebooks.class.getResource(
"/com/gint/app/bisis4/client/circ/jaspers/picturebooks.jasper")
.openStream(), params, new JREmptyDataSource());
return jp;
} catch (JRException e) {
e.printStackTrace();
return null;
}
}
示例12: service
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
@Override
public void service(
HttpServletRequest request,
HttpServletResponse response
) throws IOException, ServletException
{
ServletContext context = this.getServletConfig().getServletContext();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
try
{
String reportFileName = context.getRealPath("/reports/WebappReport.jasper");
File reportFile = new File(reportFileName);
if (!reportFile.exists())
throw new JRRuntimeException("File WebappReport.jasper not found. The report design must be compiled first.");
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("ReportTitle", "Address Report");
parameters.put("BaseDir", reportFile.getParentFile());
JasperPrint jasperPrint =
JasperFillManager.fillReport(
reportFileName,
parameters,
new WebappDataSource()
);
request.getSession().setAttribute(BaseHttpServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);
}
catch (JRException e)
{
out.println("<html>");
out.println("<head>");
out.println("<title>JasperReports - Web Application Sample</title>");
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
out.println("</head>");
out.println("<body bgcolor=\"white\">");
out.println("<span class=\"bnew\">JasperReports encountered this error :</span>");
out.println("<pre>");
e.printStackTrace(out);
out.println("</pre>");
out.println("</body>");
out.println("</html>");
}
out.println("<html>");
out.println("<head>");
out.println("<title>JasperReports - Web Application Sample</title>");
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
out.println("</head>");
out.println("<body bgcolor=\"white\">");
out.println("<span class=\"bold\">The compiled report design was successfully filled with data.</span>");
out.println("</body>");
out.println("</html>");
}
示例13: service
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
@Override
public void service(
HttpServletRequest request,
HttpServletResponse response
) throws IOException, ServletException
{
ServletContext context = this.getServletConfig().getServletContext();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
try
{
File reportFile = new File(context.getRealPath("/reports/WebappReport.jasper"));
if (!reportFile.exists())
throw new JRRuntimeException("File WebappReport.jasper not found. The report design must be compiled first.");
JasperReport jasperReport = (JasperReport)JRLoader.loadObjectFromFile(reportFile.getPath());
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("ReportTitle", "Address Report");
parameters.put("BaseDir", reportFile.getParentFile());
JasperPrint jasperPrint =
JasperFillManager.fillReport(
jasperReport,
parameters,
new WebappDataSource()
);
HtmlExporter exporter = new HtmlExporter();
request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
SimpleHtmlExporterOutput output = new SimpleHtmlExporterOutput(out);
output.setImageHandler(new WebHtmlResourceHandler("image?image={0}"));
exporter.setExporterOutput(output);
exporter.exportReport();
}
catch (JRException e)
{
out.println("<html>");
out.println("<head>");
out.println("<title>JasperReports - Web Application Sample</title>");
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
out.println("</head>");
out.println("<body bgcolor=\"white\">");
out.println("<span class=\"bnew\">JasperReports encountered this error :</span>");
out.println("<pre>");
e.printStackTrace(out);
out.println("</pre>");
out.println("</body>");
out.println("</html>");
}
}
示例14: service
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
@Override
public void service(
HttpServletRequest request,
HttpServletResponse response
) throws IOException, ServletException
{
ServletContext context = this.getServletConfig().getServletContext();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
try
{
JasperCompileManager.compileReportToFile(context.getRealPath("/reports/WebappReport.jrxml"));
}
catch (JRException e)
{
out.println("<html>");
out.println("<head>");
out.println("<title>JasperReports - Web Application Sample</title>");
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
out.println("</head>");
out.println("<body bgcolor=\"white\">");
out.println("<span class=\"bnew\">JasperReports encountered this error :</span>");
out.println("<pre>");
e.printStackTrace(out);
out.println("</pre>");
out.println("</body>");
out.println("</html>");
return;
}
out.println("<html>");
out.println("<head>");
out.println("<title>JasperReports - Web Application Sample</title>");
out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"../stylesheet.css\" title=\"Style\">");
out.println("</head>");
out.println("<body bgcolor=\"white\">");
out.println("<span class=\"bold\">The JRXML report design was successfully compiled.</span>");
out.println("</body>");
out.println("</html>");
}
示例15: update
import net.sf.jasperreports.engine.JRException; //导入方法依赖的package包/类
/**
* Performs the update of the selected report design files.
*/
protected void update() throws BuildException
{
Collection<String> files = reportFilesMap.keySet();
if (files != null && files.size() > 0)
{
boolean isError = false;
System.out.println("Updating " + files.size() + " report design files.");
String srcFileName = null;
String destFileName = null;
File destFileParent = null;
for (Iterator<String> it = files.iterator(); it.hasNext();)
{
srcFileName = it.next();
destFileName = reportFilesMap.get(srcFileName);
destFileParent = new File(destFileName).getParentFile();
if(!destFileParent.exists())
{
destFileParent.mkdirs();
}
try
{
System.out.print("File : " + srcFileName + " ... ");
JasperDesign jasperDesign = JRXmlLoader.load(srcFileName);
if (updaters != null)
{
for(int i = 0; i < updaters.size(); i++)
{
ReportUpdater updater = updaters.get(i).getUpdater();
if (updater != null)
{
jasperDesign = updater.update(jasperDesign);
}
}
}
new JRXmlWriter(jasperReportsContext).write(jasperDesign, destFileName, "UTF-8");
System.out.println("OK.");
}
catch(JRException e)
{
System.out.println("FAILED.");
System.out.println("Error updating report design : " + srcFileName);
e.printStackTrace(System.out);
isError = true;
}
}
if(isError)
{
throw new BuildException("Errors were encountered when updating report designs.");
}
}
}