我想你試圖向客戶發送PDF票。請使用這些線創建模板,並傳遞參數:
ReportAdminServiceRemote birtAdmService = (ReportAdminServiceRemote)MXServer.getMXServer().lookup(「BIRTREPORT」);
byte[] abyte0 = birtAdmService .runReport(userInfo, reportName, appName, parameterData, filename, 「pdf」);
一旦生成字節你可以這樣說:
public String actionDownload() throws Exception{
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Content-Disposition","attachment; filename=\"" + example.pdf+ "\"");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control","must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma", "public");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ByteArrayInputStream bis = new ByteArrayInputStream(abyte0);
inputStream = bis;
return SUCCESS;
}
所有學分轉到作者對這些網頁:
http://www.maximonews.com/?p=65
http://www.coderanch.com/t/432713/Struts/Struts-Files-DownLoad-Streaming-as
謝謝你會嘗試它,但它會自動生成並顯示票證。我不需要調用invokation引擎到BIRT – 2012-01-18 05:51:07
我不知道這一點。一切看起來都很好。 – batbaatar 2012-01-18 05:53:44