<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="net.sf.jasperreports.engine.*" %>
<%@ page import="net.sf.jasperreports.engine.util.*" %>
<%@ page import="net.sf.jasperreports.engine.export.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.naming.*" %>
<%@ page import="javax.sql.*" %>
<%
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("moia");
Connection conn = ds.getConnection();
HashMap params = new HashMap();
params.put("", "");
//String rptName = request.getParameter("rptName");
//JasperPrint jasperPrint = JasperFillManager.fillReport("/" + rptName + ".jasper", params, conn);
File business_rpt = new File(application.getRealPath("snts/cwszcs/reports/dklxsrb.jasper"));
out.println(business_rpt.toString());
JasperPrint jasperPrint=null;
try{
jasperPrint=JasperFillManager.fillReport(business_rpt.getPath(),params,conn);
}catch(JRException e){
e.printStackTrace();
}
//String rptType = request.getParameter("rptType");
String rptType="tabular";
if("tabular".equals(rptType))
{
JRExporter exporter = null;
//String exportTo = request.getParameter("exportTo");
String exportTo="Excel (*.xls)";
if("HTML (*.html)".equals(exportTo))
{
exporter = new JRHtmlExporter();
exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
}
else if("PDF (*.pdf)".equals(exportTo))
{
exporter = new JRPdfExporter();
response.setContentType("application/pdf");
}