当前位置:编程学习 > JAVA >>

Spring mvc中jasperreport在导出饼图或者是其他图时报错

Spring mvc中jasperreport在html格式时导出饼图或者是其他图报错
配置信息如下:
<beans:bean id="javaBeanViewResolver"
class="org.springframework.web.servlet.view.jasperreports.JasperReportsViewResolver">
<beans:property name="order" value="1" />
<beans:property name="viewClass"
value="org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView">
</beans:property>
<beans:property name="prefix" value="/WEB-INF/jasper/" />
<beans:property name="suffix" value=".jrxml" />
<beans:property name="viewNames" value="rt*" />
<beans:property name="reportDataKey" value="datasource" />
<beans:property name="exporterParameters">
<beans:map>
<beans:entry
key="net.sf.jasperreports.engine.JRExporterParameter.CHARACTER_ENCODING">
<beans:value>utf-8</beans:value>
</beans:entry>
<beans:entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN">
<beans:value type="java.lang.Boolean">false</beans:value>
</beans:entry>
<beans:entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_URI">
<beans:value type="java.lang.String">/WEB-INF/html/image.jsp?image=
</beans:value>
</beans:entry>
<beans:entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IMAGES_DIR_NAME">
<beans:value type="java.lang.String">\\***\\web\\tmp
</beans:value>
</beans:entry>
<beans:entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR">
<beans:value type="java.lang.Boolean">true</beans:value>
</beans:entry>
<beans:entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.HTML_FOOTER">
<beans:value type="java.lang.String">
</beans:value>
</beans:entry>
<beans:entry
key="net.sf.jasperreports.engine.export.JRHtmlExporterParameter.HTML_HEADER">
<beans:value type="java.lang.String">
</beans:value>
</beans:entry>
</beans:map>
</beans:property>
</beans:bean>

报错信息:
net.sf.jasperreports.engine.JRException: Error writing to image file : \\***\web\tmp|?????\img_0_0_0
at net.sf.jasperreports.engine.export.JRHtmlExporter.exportReport(JRHtmlExporter.java:668)
at org.springframework.ui.jasperreports.JasperReportsUtils.render(JasperReportsUtils.java:92)
at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsSingleFormatView.renderReportUsingWriter(AbstractJasperReportsSingleFormatView.java:97)
at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsSingleFormatView.renderReport(AbstractJasperReportsSingleFormatView.java:68)
at org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView.renderReport(JasperReportsMultiFormatView.java:193)
at org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.renderMergedOutputModel(AbstractJasperReportsView.java:564)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262) Spring MVC jasperreport 出错 --------------------编程问答-------------------- 急等啊,亲有知道的没? --------------------编程问答-------------------- 你的FileResolver怎么写的?
试一下
FileResolver fileResolver = new FileResolver() {

     @Override
     public File resolveFile(String fileName) {
        URI uri;
        try {
          uri = new URI(this.getClass().getResource(fileName).getPath());
          return new File(uri.getPath());
        } catch (URISyntaxException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          return null;
        }
    }
};
--------------------编程问答-------------------- 哥,我下来了你的etes,部署运行后,没发现有关报表的东东。能否给个全的sourcecode ,谢谢了!!!
补充:Java ,  Web 开发
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,