您的位置:首页 > 其它

weblogic下使用ireport打印【子报表】无法取得路径的解决办法

2011-07-25 14:45 549 查看
因为在weblogic中部署的是程序包,所以它不具备文件目录结构,所以无法直接按照以往的规则获取,可以采取下面的方式进行转换
// 设置子报表的路径
String root_path = this.getClass().getClassLoader().getResource("/").getPath();
String realPath = "";
for(int i=1;i<root_path.split("/").length;i++) {
if(i == root_path.split("/").length-1){
break;
}
realPath += root_path.split("/")[i]+"/";
}
realPath = realPath.replace("\\", "\\\\");
realPath = realPath + "\\\\report\\\\lrs\\\\";
parameterMap.put("SUBREPORT_DIR", realPath);
InputStream template = null;
template = this.servlet.getServletContext().getResourceAsStream(
"/WEB-INF/report/dp_prc/person.jasper");
report.toPDF(template, parameterMap, response);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐