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);
// 设置子报表的路径
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);
相关文章推荐
- Mac 下添加路径的办法,以及conda无法使用的解决办法
- 使用RDLC报表出现打印“客户端无法加载打印控件”解决方法
- VS2008 水晶报表发布后无法打印的解决办法(转)
- asp.net上传文件使用file控件,判断文件大小,取得文件路径时报错【System.IO.FileNotFoundException:未能找到文件】的解决办法
- vmware提示:此虚拟机似乎正在使用中,无法取得所有权的解决办法
- IE8无法取得客户端完整路径的解决办法
- 使用android stuido 编译项目时,项目的路径包含中文无法编译成功解决办法
- VS2008 水晶报表 打印对话框无法下载问题的解决办法(转)
- VS2008 水晶报表 打印对话框无法下载问题的解决办法(转)
- VS2008 水晶报表 打印对话框无法下载问题的解决办法(转)
- “权限使用网络资源...windows无法找到网络路径”解决办法
- 网页报表等无法打印提示网页上有错误的解决办法
- 此虚拟机似乎正在使用中,无法取得所有权 解决办法
- VS2008+水晶报表 发布后可能无法打印的解决办法
- vmware提示:此虚拟机似乎正在使用中,无法取得所有权的解决办法
- Java使用Runtime.exec无法打开路径带空格的文件(报错)的解决办法
- asp.net上传文件使用fileupload控件,判断文件类型和大小,取得文件路径时报错【System.IO.FileNotFoundException:未能找到文件】的解决办法
- vmware提示:此虚拟机似乎正在使用中,无法取得所有权的解决办法
- 快逸报表在瑞星2009下填报编辑框无法使用的解决办法
- IE8无法取得客户端完整路径的解决办法