Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Chart not showing from local folder
hbtmus
Hello,
Any help is really appreciated. I try to render a chart as rptdesign to a jsp as html.
It generates the correct html code. IE prevents of security reason the acces to the local folder.
How can I solve this problem?
Thanks.
Herbert
My code:
try {
IReportEngine engine = BirtEngine.getEngine();
if (engine != null) {
//Open the report design
IReportRunnable design = engine.openReportDesign(chartName);
//Create task to run and render the report,
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
task.setParameterValue("SCHEMA", BirtEngine.getDBSchema());
task.getAppContext().put("dashboardMemberships", dashboardMemberships); // set data
//Setup rendering to HTML
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat("html");
options.setEmbeddable(true);
options.setHtmlPagination(false);
options.setImageDirectory("c:/Spirit/ChartData");
//set this if you want your image source url to be altered
//If using the setBaseImageURL, make sure to set image handler to HTMLServerImageHandler
//options.setBaseImageURL("http://myhost/prependme?image=");
//options.setBaseImageURL("http://10.1.2.95:9080/c:/c:/Spirit/ChartData");
options.setHtmlRtLFlag(false);
options.setOutputStream(reportOutput);
//file based images
options.setImageHandler(new HTMLCompleteImageHandler());
//Web based images. Allows setBaseImageURL to prepend to img src tag
//options.setImageHandler(new HTMLServerImageHandler());
task.setRenderOption(options);
//run and render report
task.run();
task.close();
}
}
catch( Exception ex)
{
ex.printStackTrace();
}
Find more posts tagged with
Comments
hbtmus
Hello,
I generate a chart as html code and this works fine (the html code in the jsp is correct),
but the browser is not showing the chart because of local security restrictions.
How can I get this to work in a local web development environment?
Any help is really appreciated.
Thanks, Herbert
My code:
try {
IReportEngine engine = BirtEngine.getEngine();
if (engine != null) {
//Open the report design
IReportRunnable design = engine.openReportDesign(chartName);
//Create task to run and render the report
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
task.setParameterValue("SCHEMA", BirtEngine.getDBSchema());
task.getAppContext().put("dashboardMemberships", dashboardMemberships); // set data
//Setup rendering to HTML
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat("html");
options.setEmbeddable(true);
options.setHtmlPagination(false);
options.setImageDirectory("c:/Spirit/ChartData");
//set this if you want your image source url to be altered
//If using the setBaseImageURL, make sure to set image handler to HTMLServerImageHandler
//options.setBaseImageURL("http://myhost/prependme?image=");
//options.setBaseImageURL("http://10.1.2.95:9080/c:/c:/Spirit/ChartData");
options.setHtmlRtLFlag(false);
options.setOutputStream(reportOutput);
//file based images
options.setImageHandler(new HTMLCompleteImageHandler());
//Web based images. Allows setBaseImageURL to prepend to img src tag
//options.setImageHandler(new HTMLServerImageHandler());
task.setRenderOption(options);
//run and render report
task.run();
task.close();
}
}
catch( Exception ex)
{
ex.printStackTrace();
}
try
{
JspWriter out = pc.getOut();
// Write the html code to jsp
out.print(reportOutput);
}
catch(IOException e)
{
System.out.println("IO Error in JSP controller ViewDashboardMembership, " + e.toString());
}