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

sabinash

Members
  • Posts

    11
  • Joined

  • Last visited

sabinash's Achievements

Apprentice

Apprentice (3/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Thanks for your response, i am using actually oracle jdk 1.6 in my application, I dont think it is jdk problem. These things are working good in simple web application without struts2. In struts2 these images are not working, kindly give any idea about jasper report with struts2 with html output Thanks In Advance Abinash
  2. Hi All, JRHtmlExporterParameter.IMAGES_URI is not working in struts2. In IMAGES_URI i am calling the net.sf.jasperreports.j2ee.servlets.ImageServlet for charts in html output.
  3. Thnks Sara for reply, I have all the required library, itext-2.1.7.jar jasperreports-4.5.1.jar jcommon-1.0.15.jar jfreechart-1.0.12.jar Problem is, i am actually using the struts2, same thing i tried in simple servelet and jsp, images are coming good in html output, when i tried in struts2 the images not coming as it should be. problem in stuts2 the exporter parameter i.e exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, request.getContextPath()+"/servlets/image?image="); This parameter actually not working in struts2 Thanks Abinash
  4. Thanks For your quick response, In for me also in PDF these charts are working fine, i am facing the issue when i am trying show these charts in html output, if you have any solution for html format please let me know.. Thanks in advance
  5. I did charts in my application, these are showing ok in pdf format, when try to run the report in html format, the charts images are not founr, the broken images are displayin on html out put instead of charts, pls tell your charts are running on which format .
  6. can you tell, These charts are showing in html or any other format ? its urgent !!!!!!!!!!!!!
  7. Thanks For reply dear, i tried this one also still i m facing same issue, the images stil not found, now thw images path showing http://localhost:8080/DemoReports/ReportImageServlet?rnd=0.6676469148302265&image=img_0_0_2 Code:my report images servlet: import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletConfig;import javax.servlet.ServletContext;import javax.servlet.ServletException;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.log4j.Logger;import net.sf.jasperreports.j2ee.servlets.ImageServlet;public class ReportImageServlet extends ImageServlet { /** * */ private static final long serialVersionUID = -7699356350685527240L; static protected Logger log = Logger.getLogger(ImageServlet.class); private ServletContext context; /** * Constructor of the object. */ public ReportImageServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { doPost(request, response); } catch (Exception e) { log.error(e); e.printStackTrace(); } } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { super.doPost(request, response); } catch (ServletException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Returns information about the servlet, such as * author, version, and copyright. * * @return String information about this servlet */ public String getServletInfo() { return ""; } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init(ServletConfig servletconfig) throws ServletException { try { super.init(servletconfig); context = servletconfig.getServletContext(); } catch (Exception e) { log.error(e); e.printStackTrace(); } }}my struts.xml<struts> <constant name="struts.action.excludePattern" value="/ReportImageServlet"/>
  8. Hi all, Can somebody help me to get the chart images in html output in jaspre report ? The chart images properly coming in the pdf output, but in html output the chart images are coming as a broken images mamed img_0_0_0 from the images path of the application, actually these images are not there, and also in pdf format the chart images are repated ly printing. like suppose the list containg 5 values the number chart displaying 5. can somebody help me how to resolve this issue, plases reply soon. Thanks in advance. Thanks & Regards Abinash Sahu Code:My stuts.xml<action name="getMenuUtilizationChart" class="com.realsoftinc.demoreport.action.ReportOneAction" method="reportChart"> <result name="success" type="jasper"> <param name="location"> jasper/report4.jasper </param> <param name="dataSource">jasperChartList</param> </result>My action class.... public String reportChart() { JasperReport jasperReport; JasperPrint jasperPrint; JasperDesign jasperdesign; FileReadWriteOperation frwo = null; try{ frwo = new FileReadWriteOperation(); jasperChartList=frwo.showReportChart(); String reportSource; String sourceFile; reportSource = ServletActionContext.getServletContext() .getRealPath("/jasper/report4.jrxml"); HashMap map = new HashMap(); JRBeanCollectionDataSource datasource = new JRBeanCollectionDataSource(jasperChartList); jasperReport = JasperCompileManager.compileReport(reportSource); jasperPrint = JasperFillManager.fillReport(jasperReport, map, datasource); JRHtmlExporter exporter = new JRHtmlExporter(); ServletActionContext.getResponse().setContentType("text/html"); PrintWriter responseStream = ServletActionContext.getResponse().getWriter(); request.getSession(true).setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint); /*byte[] output = null ;*/ exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, responseStream); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,Boolean.FALSE); //exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, request.getContextPath() + imageServletUrl); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "images?image="); exporter.exportReport(); }catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return SUCCESS; }
  9. Hi All, I am facing the problem to show the jasper report in html format from the last two weeks, its so much irritated, i tried everything to show the images in html format, still i could not get any solution, actully what is heppening when i try to run the report in html format, the jasper report while creting the report it is internally creates a some images, like px, img_0_0_1 which are not available in our application's images folder, for that its showing no images icon in the htmal pages. when we try to open this px images in local drive nothing is there. But same thing is working fine in other format like PDF. But after exporting to html format this report these imagrs are working fine but at the runtime the images are not working. I am using struts2 for java application, i am calling jrxml file from the action classes, For creating jrxml file i am using the ireport tool. Can somebody help me how to get the proper iamges in the html format, its very urgent i stuck from last two weeks Thanks in advance Thanks And Regards Abinash Sahu Code:my struts.xml<package name="default" extends="struts-default,jasperreports-default"> <result-types> <result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult"/> </result-types><action name="getDateWiseReport" class="com.realsoftinc.demoreport.action.ReportOneAction" method="reportone"> <result name="success" type="jasper"> <param name="location"> jasper/report3.jasper </param> <param name="dataSource">jasperList</param> <param name="format">HTML</param> </result> </action>My action classs: @SuppressWarnings("unchecked") public String reportone() { JasperReport jasperReport; JasperPrint jasperPrint; JasperDesign jasperdesign; FileReadWriteOperation frwo = null; try{ frwo = new FileReadWriteOperation(); jasperList=frwo.showReportOne(); String reportSource; String sourceFile; reportSource = ServletActionContext.getServletContext() .getRealPath("/jasper/report3.jrxml"); HashMap map = new HashMap(); /*String jasperPath= new String(ServletActionContext.getServletContext().getRealPath("/jasper/")); String imagePath = new String(ServletActionContext.getServletContext().getRealPath("/images/")); String jspPath = new String(ServletActionContext.getServletContext().getRealPath("/jsp/")); map.put("imagePath",imagePath); map.put("jspPath", jspPath);*/ /*sourceFile = ServletActionContext.getServletContext() .getRealPath("/jasper/report3.jasper"); */ JRBeanCollectionDataSource datasource = new JRBeanCollectionDataSource(jasperList); jasperReport = JasperCompileManager.compileReport(reportSource); jasperPrint = JasperFillManager.fillReport(jasperReport, map, datasource); //JasperRunManager.runReportToHtmlFile(sourceFile, new HashMap(), datasource); //JasperViewer.viewReport(jasperPrint, false); }catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return SUCCESS; }
  10. Hi All, Can somebody help me how to give save as option in jasper report for user to save the report in local drive from the server while exporting the report from the server through jasper report. please somebody reply the answer, its urgent. Thanks in advance Thannks And Regards Abinash Sahu Code:my action class:outputfile ="C:\\REPORTS\\JasperReport.xls"; File file = new File("C:\\REPORTS");ByteArrayOutputStream output = new ByteArrayOutputStream(); OutputStream outputfileXLS= new FileOutputStream(new File((outputfile))); JRXlsExporter exporterXLS = new JRXlsExporter(); exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, output); exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.TRUE); exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); exporterXLS.exportReport(); outputfileXLS.write(output.toByteArray());Instead of mentioning the path to save the file, is there any way to give any option to save the exported file to local mechines..
  11. Hi All, I am new to the jasper report can somebody help me how to pass the absolute path of the apllication folder (struts2 in tomcat) to my jrxml file where i can refer the images , files or any other resourses from the application folder. when i pass the path of the application from my acttion class of the struts to my jrxml file through Hashmap key value pair. In jrxml file, the path is showing null. can somebody help me how to acess these application's absolute path in my jrxml file. Pleaee reply its urgent. i am stuck from the last two weeks Thanks in advance. Thanks & Regards Abinash Sahu Code:My Stuts.xml<package name="default" extends="struts-default,jasperreports-default"> <result-types> <result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult"/> </result-types><action name="ddMenuRpt" class="com.realsoftinc.demoreport.action.ReportOneAction" method="showJasperReportDetails"> <result name="success" type="jasper"> <param name="location"> jasper/report2.jasper </param> <param name="dataSource">ddjasperList</param> </result> </action>My action class:public String showJasperReportDetails(){ FileReadWriteOperation frwo = null; String sourceFile = null; String destinationFile=null; String outputfile =null; JasperReport jasperReport; JasperPrint jasperPrint; JasperDesign jasperdesign; try { frwo = new FileReadWriteOperation(); ddjasperList = frwo.showJasperDrill(date,menuId); sourceFile = ServletActionContext.getServletContext().getRealPath("jasper/report2.jrxml"); // String reportSource; HashMap parameters = new HashMap(); parameters.put("date", date); parameters.put("menus", menuId); parameters.put("Drilled_Report", new String("DrilledDown Report")); String jasperPath= new String(ServletActionContext.getServletContext().getRealPath("/jasper/")); String imagePath = new String(ServletActionContext.getServletContext().getRealPath("/images/")); String jspPath = new String(ServletActionContext.getServletContext().getRealPath("/jsp/")); parameters.put("imagePath",imagePath); parameters.put("jspPath", jspPath); reportSource = ServletActionContext.getServletContext() .getRealPath("/jasper/report2.jrxml"); JRBeanCollectionDataSource datasource = new JRBeanCollectionDataSource(ddjasperList); destinationFile = ServletActionContext.getServletContext().getRealPath("jasper/report2.jrxml"); jasperReport = JasperCompileManager.compileReport(reportSource); jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, datasource); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); return ERROR; } return SUCCESS; }
×
×
  • Create New...