2014-01-15 2 views
0

BIRT 차트 보고서를 jsp..if로로드 할 때 문제가 발생했습니다. 내 보고서에 테이블을 사용하면 멋지게 표시되지만 차트로 변경하면 내 jsp에서 빈 페이지가 표시됩니다 .. 어떻게이 문제를 해결할 수 있습니까 ??JSP 내부에 BIRT 차트를로드 할 수 없습니다

여기 내 HTML 렌더링입니다.

public Resolution htmlReport() throws EngineException, SemanticException { 
      ByteArrayOutputStream reportOutput = new ByteArrayOutputStream(); 

      String path = getCompassContext().getServletContext().getRealPath(
        "/report"); 

      // @TODO 
      String user = getCompassContext().getUser().getUsername(); 
      birtReport.setUser(user); 
      birtReport.setBirtEngine(getCompassContext().getBirtEngine()); 

      path = CompassConfig.getBirtReport(); //+ "/login_time.rptdesign"; 
      birtReport.setReportDesignPath(path); 
      birtReport.setReportDesignName("/test.rptdesign"); 
      /** 
      * Generates the html report. 
      * 
      * @return forward to the jsp page 
      * @throws EngineException when opening report design or reunning the report 
      * @throws SemanticException when changing properties of DesignElementHandle 
      */ 
      // set output options 
       IHTMLRenderOption options = new HTMLRenderOption(); 

       options.setOutputFormat(IHTMLRenderOption.OUTPUT_FORMAT_HTML); 
       options.setOutputStream(reportOutput); 
       options.setEmbeddable(false); 
       // options.setBaseImageURL(context.getRequest().getContextPath() + "/images"); 
       //options.setImageDirectory(context.getServletContext().getRealPath("/images")); 
       options.setImageHandler(new HTMLServerImageHandler()); 
       options.setMasterPageContent(true); 

       birtReport.generateReport(options); 

       return new StreamingResolution("text/html", new ByteArrayInputStream(reportOutput.toByteArray())); 
      } 

여기 내 BIRT 엔진

public void generateReport(IRenderOption options) throws EngineException, 
      SemanticException { 

     generateParamaters(); 

     // get the engine 
     IReportEngine birtReportEngine = birtEngine; 

     // open the report design 
     String path = reportDesignPath + "/" + reportDesignName; 
     IReportRunnable design = birtReportEngine.openReportDesign(path); 

     // create task to run and render report 
     IRunAndRenderTask task = birtReportEngine 
       .createRunAndRenderTask(design); 

     Map<String, Object> appContext = task.getAppContext(); 
     Connection con = DataSourceUtils.getConnection(); 
     appContext.put("OdaJDBCDriverPassInConnection", con); 

     HashMap<String, String[]> multiValParam = getMultiValParam(); 
     if(multiValParam != null && multiValParam.size() > 0) { 
      Set<String> key = multiValParam.keySet(); 
      Iterator<String> ite = key.iterator(); 

      while(ite.hasNext()) { 
       String paramName = (String) ite.next(); 
       String[] paramValues = multiValParam.get(paramName); 

       task.setParameterValue(paramName, paramValues); 
      } 
     } 
     task.setParameterValues(getParameter()); 
     task.setRenderOption(options); 
     task.setAppContext(appContext); 

     // run report 
     task.run(); 
     task.close(); 
    } 

정말 도움이 필요

입니다 !!!!

답변

0

난 이미 answer..you이 (참) setEmbeddable 이하로 렌더링되는 HTML 내부에 둘 필요가 찾을 수 있습니다

options.setBaseImageURL (getCompassContext(). 대해 GetRequest(). 대해 getContextPath() + "/ 이미지") ; options.setImageDirectory (getCompassContext(). getServletContext(). getRealPath ("/ images"));

및 appContext.put

DesignElementHandle reportChart = design.getDesignHandle() GetModuleHandle 함수() findElement ("reportChart") 아래의 생성 보고서 내에서이 코드를 삽입해야합니다..;

관련 문제