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

dnvsrikanth

Members
  • Posts

    346
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by dnvsrikanth

  1. Hi all I am using JasperReports to create reports. In my application I have a requirement in which I need to create drill-downs in my report.When we click on a record in already generated data i want a drill down which shows the data related to that particular record. for example first i want to display all the employees who are in supervisor designation. On click of a particular record i want a drill-down which shows all the employees who are reporting to that particular supervisor Can anyone tell me how to create this, or show a sample code... I am in urgent need of this task...I Hope that i will get a solution in this forum Thanks & Regards DNV Srikanth
  2. Hi all I am using JasperReports to create reports. In my application I have a requirement in which I need to create drill-downs in my report.When we click on a record in already generated data i want a drill down which shows the data related to that particular record. for example first i want to display all the employees who are in supervisor designation. On click of a particular record i want a drill-down which shows all the employees who are reporting to that particular supervisor Can anyone tell me how to create this, or show a sample code... I am in urgent need of this task...I Hope that i will get a solution in this forum Thanks & Regards DNV Srikanth
  3. Hi I am trying to export a report to different formats. Exporting the report to all other formats is success except for HTML format. The report is being exported to HTML format but The web page is unable to show the images that are being exported. Can anyone help me out in this regard... Thanks in advance
  4. Hi I am trying to generate dynamic report by taking already existing jrxml file and modifying the jrxml file. While generating the report in pdfstream by taking the modified report template into inputstream object I am encountering NullPointerException. But I am able to generate PDF file and HTML file. Can you please help me in resolving this problem. I am trying this error from 2 weeks.:( :sick: I am herewith providing the code: public class Replace_Tag extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @param request servlet request * @param response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try{ Connection con; Class.forName("net.sourceforge.jtds.jdbc.Driver"); con = DriverManager.getConnection("jdbc:jtds:sqlserver://10.2.84.71/Metrics_Commercial_152;instance=", "metric", "metric"); JasperCompileManager.compileReportToFile("chart.jrxml"); String path = this.getServletConfig().getServletContext().getRealPath("chart.jasper"); //System.out.println("The path of jasper file is: " + path); InputStream inputStream = this.getServletContext().getResourceAsStream("chart.jasper"); ServletOutputStream servletOutputStream = response.getOutputStream(); JasperRunManager.runReportToPdfFile("chart.jasper", "linechart.pdf", null, con); JasperRunManager.runReportToHtmlFile("chart.jasper", "linechart.html", null, con); JasperRunManager.runReportToPdfStream(inputStream, servletOutputStream, null, con); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); //parsing the document Document doc = db.parse("chart.jrxml"); NodeList lineNodeList = doc.getElementsByTagName("lineChart"); NodeList linePlotList = doc.getElementsByTagName("linePlot"); int lineNodeListLength = lineNodeList.getLength(); int linePlotListLength = linePlotList.getLength(); for(int i=0;i<lineNodeListLength;i++){ Node lineChartNode = lineNodeList.item(i); Node renamed = doc.renameNode(lineChartNode, "", "barChart"); } for(int j=0;j<linePlotListLength;j++) { Node linePlotNode = linePlotList.item(j); Node renamedPlot = doc.renameNode(linePlotNode, "", "barPlot"); } boolean result = saveXMLDocument("barchart.jrxml", doc); JasperCompileManager.compileReportToFile("barchart.jrxml", "/reports/barchart.jasper"); inputStream = this.getServletContext().getResourceAsStream("/reports/barchart.jasper"); JasperRunManager.runReportToPdfFile("barchart.jasper", "barchart.pdf", null, con); JasperRunManager.runReportToHtmlFile("barchart.jasper", "barchart.html", null, con); JasperRunManager.runReportToPdfStream(inputStream, servletOutputStream, null, con); System.out.println("The report is generated in pdf stream"); con.close(); response.setContentType("application/html"); servletOutputStream.flush(); servletOutputStream.close(); }catch(DOMException de){ de.printStackTrace(); }catch(JRException jre){ jre.printStackTrace(); }catch(Exception e){ e.printStackTrace(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * @param request servlet request * @param response servlet response */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * @param request servlet request * @param response servlet response */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. */ @Override public String getServletInfo() { return "Short description"; } // </editor-fold> public boolean saveXMLDocument(String fileName, Document doc) { System.out.println("Saving XML file... " + fileName); // open output stream where XML Document will be saved File xmlOutputFile = new File(fileName); FileOutputStream fos; Transformer transformer; try { fos = new FileOutputStream(xmlOutputFile); } catch (FileNotFoundException e) { System.out.println("Error occured: " + e.getMessage()); return false; } // Use a Transformer for output TransformerFactory transformerFactory = TransformerFactory.newInstance(); try { transformer = transformerFactory.newTransformer(); } catch (TransformerConfigurationException e) { System.out.println("Transformer configuration error: " + e.getMessage()); return false; } DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(fos); // transform source into result will do save try { transformer.transform(source, result); } catch (TransformerException e) { System.out.println("Error transform: " + e.getMessage()); } System.out.println("XML file saved."); xmlOutputFile.setExecutable(true); return true; } } Or else can u please help me in generating dynamic reports on fly based on user input. The report generation mechanism should have such a capacity to display one type of chart from another type of chart by modifying the same jrxml source. I am sorry if this is confusing u...
  5. thanks for your reply freeman, But my requirement is like this: modification should be done in same jrxml report template dynamically without creating a seperate jrxml file for each type of chart. Can we do this??? If we can, how can we do so??? Thanking You DNV Srikanth
  6. Hi I have a requirement like this: Suppose that I have already extracted data from database using an SQL query. Now I want to generate a chart for this data dynamically based on the user input.What I mean to say is user is given choice to select what type of chart he needs. Based on the user input we need to generate the chart. How to do this...Am looking for it for about one month. :( Can anyone please help me out in this regard Thanking You DNV Srikanth
  7. Hi I have a requirement like this: Suppose that I have already extracted data from database using an SQL query. Now I want to generate a chart for this data dynamically based on the user input.What I mean to say is user is given choice to select what type of chart he needs. Based on the user input we need to generate the chart. How to do this...Am looking for it for about one month. :( Can anyone please help me out in this regard Thanking You DNV Srikanth
  8. The problem still exists...Can anyone please solve this problem???
  9. hi Thanks for your quick reply.... Yes...the file exists in the specified location. I've already set set the Contex to application/pdf. So do I need to give .jasper file to the input stream if its already compiled and ready???
  10. hi Thanks for ur help.....I am herewith posting stack trace..... java.lang.NullPointerException at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2264) at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2277) at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2748) at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780) at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280) at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:191) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:361) at net.sf.jasperreports.engine.JasperRunManager.runReportToPdfStream(JasperRunManager.java:163) at com.ReporDtataSource.doGet(ReporDtataSource.java:50) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:619)
  11. hi all, While generating a report which retrieves data from SQL Server 2000 and displaying it in PDF format , a NullPointerException is being thrown.I cant resolve why the exception is being generated. Can any body help me out in this regard.... I am giving the servlet code: package com; import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.util.HashMap; import javax.servlet.*; import javax.servlet.http.*; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperRunManager; /** * * @author srikanth.d * @version */ public class ReporDtataSource extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection con; ServletOutputStream servletOutputStream = response.getOutputStream(); InputStream inputStream = null; HashMap hm= new HashMap(); inputStream = getServletConfig().getServletContext().getResourceAsStream("/report.jrxml"); try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); con = DriverManager.getConnection("jdbc:jtds:sqlserver://10.2.84.204/Metrics_Commercial_Prototype_20;instance=","metric","metric"); JasperRunManager.runReportToPdfStream(inputStream, servletOutputStream,hm,con); HashMap()); con.close(); response.setContentType("application/pdf"); servletOutputStream.flush(); servletOutputStream.close(); }catch(Exception e){ e.printStackTrace(); } } }
×
×
  • Create New...