Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Dynamic reports::how to display report output in a frameset
bhanu_k
Hi,
I hope this is a right forum to ask my question.As per my requirement I need to generate dynamic reports using BIRT API,In Servlet when I run the report using IRunAndRenderTask.run() method report output is displayed without a frameset in browser. Please let me know the steps or API methods/parameters to display the report in BIRT default frameset.Below is a snapshot of my code thanks in advance.
public void doGet(HttpServletRequest reqest, HttpServletResponse response)
throws ServletException, IOException {
//get report name and launch the engine
response.setContentType("text/html");
String reportName = reqest.getParameter("ReportName");
String[] cols = (String[])reqest.getParameterMap().get("dyna1");
ServletContext sc = reqest.getSession().getServletContext();
this.birtReportEngine = BirtEngine.getBirtEngine(sc);
IReportRunnable design;
try
{
//Open report design
design = birtReportEngine.openReportDesign( sc.getRealPath("/Reports")+"/"+reportName );
ReportDesignHandle report = (ReportDesignHandle) design.getDesignHandle();
buildReport( cols, report );
//create task to run and render report
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask( design );
task.setAppContext(new HashMap());
//set output options
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_HTML);
options.setOutputStream(response.getOutputStream());
task.setRenderOption(options);
//run report
task.run();
task.close();
}catch (Exception e){
throw new ServletException( e );
}
}
Regards,
Bhanu.
Find more posts tagged with
Comments
s_^_s
Hi Bhanu,
Since you are using BIRT in a servlet environment, is it possible for you to use the Sample WebViewer App instead of using Birt through the API?
'Sample WebViewer' provides nice UI and I would suggest you atleast see it once if you have not seen it already. It is a separate web-app which can run independently in Tomcat (or other servers) and then pass report file name as URL parameter to open the report.
So from any page in your current web-application, you can simply have an html frame and within it send request to the WebViewer Sample App. Your reports will be shown beautifully within this frame.
[Ignore if you have reasons of not using the WebViewer
]
-Sebastian
bhanu_k
Hi Sebastian,
Thanks for the response,Please provide me the references for WebViewer I will looking into it.
The reason for using the BIRT API is that report columns and there data content will be dynamically coming from the database so I need to add the respective information in the report.In my application reports can be a letter type or simple grid type and user can export data in different formats (PDF,word,excel ).I can use the frameset viewer but the problem is I need to populate data dynamically to the reports before it renders to the user.
Please let me know your thoughts on the above requirement.
-Bhanu