java导出某个页签:
第一步:先在jsp新建一个导出界面按钮:
导出
第二步:在js中新建导出方法:
//导出数据到EXCEL表
function exportexcel(){
var rows1 = treegrid.getRootNode();
var rows = rows1.children;
var bi_id = "";
for(var i = 0 ;i
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet.
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String bi_id = request.getParameter("bi_id");
String dp = request.getParameter("dp");
bi_id=bi_id.replace("'","'");
String year = dp.substring(0,4);
String date = dp.substring(5,7);
String sql = "SELECT a.bi_name,a.bi_id,a.bi_code,a.bi_no,a.bi_build_type,c.BUILD_STAGE,a.BI_BUDGET_NO,a.BI_BEGIN_DATE,a.BI_PID,a.BI_LEVEL,b.BI_TOTAL_INVEST,b.BI_PLAN_INVEST,d.START_DATE,d.PAUSE_DATE FROM " ;
sql +="(select rownum px,bi_name,bi_id,bi_code,bi_no,bi_build_type,BI_BUDGET_NO,BI_BUDGET_APPROVAL,BI_BEGIN_DATE,BI_PID,BI_LEVEL from project_library start with bi_id in (" + bi_id + ") connect by prior bi_id = bi_pid order siblings by bi_no) a ";
sql +=" left join (SELECT * FROM project_report where report_date ='" +date +"' and report_year = '"+year+"' and project_id in(SELECT bi_id FROM project_library where bi_type = 7)) b on b.project_id = a.bi_id ";
sql +=" left join (SELECT DECODE(BUILD_STAGE,0,'预留空',1,'本年新建项目',2,'本年续建项目',3,'投运项目') BUILD_STAGE,bi_id FROM project_stage_config where bi_id in (SELECT bi_id FROM project_library where bi_type = 7)and build_date = '"+year+"') c on a.bi_id = c.bi_id ";
sql +=" left join (select substr(start_date, 1, 10) start_date,substr(pause_date, 1,10) pause_date,bi_id from (select bi_id, max(start_date) start_date,max(pause_date) pause_date from project_cycle_config group by bi_id, pause_date) ";
sql +=" where substr(start_date, 1, 7) <= '"+dp+"' and substr(nvl(pause_date, '9999-12-31'), 1, 7) >= '"+dp+"' and bi_id in(SELECT bi_id FROM project_library where bi_type = 7)) d on a.bi_id = d.bi_id ";
sql += " where a.bi_level in (0,1) or a.bi_id in(select pcc.bi_id from project_cycle_config pcc where substr(pcc.start_date, 1, 7) <= '"+dp+"' and substr(nvl(pcc.pause_date, '9999-12-31'),1,7) >= '"+dp+"') order by a.px";
ResultSet rs;
try {
rs = DbOper.executeQuery(sql);
List
对应的jar包下载地址:poi所有需要的jar下载(3.8版本)