欢迎来到天天文库
浏览记录
ID:21303947
大小:25.00 KB
页数:3页
时间:2018-10-21
《ireport直接打印报表,不预览》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、(转)ireport直接打印报表,不预览2011年02月23日星期三下午02:06打印类代码如下:packagecom.sofn.struts.report.actions;importjava.io.File;importjava.io.ObjectOutputStream;importjava.util.ArrayList;importjava.util.List;importjava.util.Map;importjavax.naming.Context;importjavax.naming.InitialCo
2、ntext;importjavax.naming.NameNotFoundException;importjavax.servlet.ServletOutputStream;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importjavax.sql.DataSource;importnet.sf.jasperreports.engine.JRException;importnet.sf
3、.jasperreports.engine.JasperFillManager;importnet.sf.jasperreports.engine.JasperPrint;importnet.sf.jasperreports.engine.JasperPrintManager;importnet.sf.jasperreports.engine.data.JRBeanCollectionDataSource;importorg.apache.struts.action.Action;importorg.apache.s
4、truts.action.ActionForm;importorg.apache.struts.action.ActionForward;importorg.apache.struts.action.ActionMapping;importcom.lowagie.text.ExceptionConverter;importcom.sofn.struts.dto.UserInfoDTO;importcom.sofn.struts.op.UserInfo;importcom.sofn.util.UserSessionOp
5、erate;publicclassReportViewActionextendsAction{ (org.apache.struts.action.ActionMapping,org.apache.struts.action.ActionForm,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) publicActionForwardexecute(ActionMappingmapping,A
6、ctionFormform, HttpServletRequestrequest,HttpServletResponseresponse) throwsException{ //已编译文件路径和格式 Stringfp=this.getServlet().getServletContext().getRealPath("/")+"report\jasper\"+request.getAttribute("rdoc")+".jasper"; Filerep
7、ortFile=newFile(fp); // System.out.println("报表路径!!!!!!!"+reportFile); Mapparameters=(Map)request.getAttribute("paras"); byte[]bytes=null; Listlist=newArrayList(); DataSourceds=null; JasperPrintjasperPrint=null;
8、 //参数传递 UserSessionOperateuso=newUserSessionOperate(); Stringuser=uso.getUser(request); UserInfoeidr=newUserInfo(); UserInfoDTOeidrdto=null;
此文档下载收益归作者所有