« Return to Thread: in struts 2 how can i view Birt report

in struts 2 how can i view Birt report

by sathu :: Rate this Message:

Reply to Author | View in Thread

hi when i try to run below code it says  "java.lang.IllegalStateException: getOutputStream() has already been called for this response  "          


  config = new EngineConfig();
                config.setEngineHome(getReportEngine());
                Platform.startup(config);
                IReportEngineFactory factory = (IReportEngineFactory) Platform
                        .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
                engine = factory.createReportEngine(config);
                IReportRunnable design = engine.openReportDesign(getReportDesign());
                IRunAndRenderTask task = engine.createRunAndRenderTask(design);
                  task.setParameterValue("FormId", new Integer(1));
                task.setParameterValue("Id", new Integer(3));
                task.validateParameters();

               
                HTMLRenderOption options = new HTMLRenderOption();                                              options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
                options.setOutputStream(response.getOutputStream());              
                task.setRenderOption(options);

The code works fine when i generate a HTML page
          HTMLRenderOption options = new HTMLRenderOption();
          options.setOutputFileName("src/main/resources/ftl/error1.html");
          options.setOutputFormat("html");
          task.setRenderOption(options);

can any one please help me

1) Instead of generating a HTML Page how can i send this response to a Ajax call(using Struts)

Thanks
Sathu





 « Return to Thread: in struts 2 how can i view Birt report