1、代码头部首先加入这段代码
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
//out.print(basePath);
%>
上述代码含义参见http://blog.csdn.net/q283595518/archive/2009/06/08/4250360.aspx
2、然后加入
<script lanuage="javascript" src="js/calendar.js"></script>
<script type="text/javascript">
function doExport(){
document.getElementById("mainform").action = '<%=basePath %>Yean/exporting.jsp';
document.getElementById("mainform").submit();
}
</script>
3、from写法
<form name="mainform" action="<%=basePath %>moni_all_detail.jsp" method="post">
4、两个按钮
<input type="submit" name="Submit" value="查询">
<input type="button" name="Submit2" value="导出" οnclick="doExport()">
这样就可以在点击“查询”按钮的时候把form提交给moni_all_detail.jsp处理,而当点击“导出”的时候提交给Yean/exporting.jsp处理了