jasper ireport生成图片的例子

可以给个jasper ireport生成图片的例子的代码例子吗?我的怎么就是显示不出来呢 :(
[b]问题补充:[/b]
不好意思没说明白我的是生成excle的啊 这是我的代码
Map parameters = new HashMap();
String path7 = req.getRealPath("") +"/congress/deputy/photo/"+attach;
parameters.put("IMAGE_DIR",path7);

try{
JasperFillManager.fillReportToFile(path + ".jasper", parameters,new CustomDataSource(temp.iterator(), field));
} catch (Exception e) {

e.printStackTrace();
}
File sourceFile = new File(path + ".jrprint");
JasperPrint jasperPrint = (JasperPrint) JRLoader.loadObject(sourceFile);
File destFile = new File(sourceFile.getParent(), jasperPrint
.getName()+ ".xls");
JRAbstractExporter exporter=new JExcelApiExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,new FileOutputStream(destFile.toString()));
exporter.exportReport();

url.append(".xls");
}catch (Exception e) {
e.printStackTrace();
}

res.sendRedirect(url.toString());
[b]问题补充:[/b]
这是报的错误
java.lang.IllegalAccessError: tried to access field com.keypoint.PngEncoder.encodeAlpha from class com.keypoint.PngEncoderB
com.keypoint.PngEncoderB.(PngEncoderB.java:127)
com.keypoint.PngEncoderB.(PngEncoderB.java:78)
net.sf.jasperreports.engine.export.JExcelApiExporter.(JExcelApiExporter.java:138)
com.egov.congress.deputy.report.DeputyGuoReport.doPost(DeputyGuoReport.java:262)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

需要在你的web.xml中配置image生成器
[code="java"]

ImageServlet

net.sf.jasperreports.j2ee.servlets.ImageServlet



ImageServlet
/image

[/code]

然后你的Export中设置如下:
[code="java"]
public void export(HttpServletRequest request,
HttpServletResponse response, String reportFilePath, Map params,
JRDataSource dataSource) {
try {
PrintWriter out = response.getWriter();
try {
response.setContentType("text/html;charset=UTF-8");
JasperPrint jasperPrint = new JasperPrintWithDataSource(
reportFilePath, params, dataSource).getJasperPrint();
// 使用JRHtmlExproter导出Html格式
JRHtmlExporter exporter = new JRHtmlExporter();
request.getSession().setAttribute(
ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE,
jasperPrint);
exporter.setParameter(JRExporterParameter.JASPER_PRINT,
jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,
[color=red]"./image?image="[/color]);
exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING,
"UTF-8");
exporter.setParameter(
JRHtmlExporterParameter.BETWEEN_PAGES_HTML, "");
exporter
.setParameter(
JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
Boolean.TRUE);

            // 导出
            exporter.exportReport();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (Exception e) {
                }
            }
        }
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
}

[/code]

能把你的代码贴出来吗?

com.egov.congress.deputy.report.DeputyGuoReport.doPost([color=red]DeputyGuoReport.java:262[/color])

这一行有错误,这一行是哪句

这个问题的话,用帆软报表做也是很方便的