<input type="button" onClick="AutomateExcel()" value="导 出">
<input type="button" value="按日" οnclick="ExportExcel('1');">
<input type="button" value="按月" οnclick="ExportExcel('2');">
<input type="button" value="按季度" οnclick="ExportExcel('3');">
<script language="javascript" type="text/javascript">
var ExportExcel=function(flag)
{
window.location.href="ExportExcel.jsp?flag="+flag;
}
</script>
处理的jsp页面:
<%
//连接数据库
Connection con = null;
Statement stm = null;
ResultSet rs2 = null;
FileInputStream fis=null;
String path= new java.io.File(application.getRealPath("config")).getParent()+"\\";
fis = new FileInputStream(new File(path+"config.properties"));
Properties prop = new Properties();
prop.load(fis);
String driverName=prop.getProperty("driverName");
String url=prop.getProperty("url");
String user = prop.getProperty("user");
String pasword = prop.getProperty("pasword");
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(url, user, pasword);
stm = con.createStatement();
//日期
int eyear,emonth,eday;
Calendar cal=Calendar.getInstance();
eyear=cal.get(Calendar.YEAR);
emonth=cal.get(Calendar.MONTH);
eday=cal.get(Calendar.DATE);
int flag=