求助jsp导出Excel问题
在jsp导出Excel时报错:
message An exception occurred processing JSP page /common/easyQueryVer3/ExportToExcel.jsp at line 25
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /common/easyQueryVer3/ExportToExcel.jsp at line 25
22: VData tConditionValue = (VData)session.getValue("RESULT_CONDITION_VALUE");
23:
24: int cols = 0;
25: String[][] result = PubFun.getDecodeEasyQueryResult(xresult);
26:
27: if(result!=null && result.length>0){
28: cols = result[0].length;
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:34)
root cause
java.lang.NullPointerException
com.sinosoft.lis.pubfun.PubFun.getDecodeEasyQueryResult(PubFun.java:1711)
org.apache.jsp.common.easyQueryVer3.ExportToExcel_jsp._jspService(ExportToExcel_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:34)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.41 logs.
已经找到是空指针问题,但是为什么会空指针呢,页面alert有数据啊,就是传到导出的jsp中没有值:
下面是我的代码:
// 导出execl
function exportExcel() {
if (GroupGrid.mulLineCount < 1) {
alert("暂无数据,无法导出");
return false;
}
var sql = document.getElementById("sql").value;
var temp = easyQueryVer3(sql.toString(), 1, 0, 1, 1);
var result = temp.replace(/\^/g, "@@@").replace(/\|/g, "---");
document.getElementById("result").value = result;
info.resultHead = "序号,部门,成本中心,成本中心编号,第一审批人,第一审批人编号,第二审批人,第二审批人编号,公司规划部采购,副总经理VP,财务总监CFO,总经理President";
info.resultConditionName = "员工编号,员工姓名,部门";
info.resultConditionValue = ",,";
info.resultTitle = "财务审批配置";
var date = new Date();
info.resultDate = date.getYear() + "-" + (date.getMonth() * 1 + 1) + "-" + date.getDate();
document.fm.action = "../common/easyQueryVer3/QueryToExport.jsp?resultHead="
+ info.resultHead
+ "&resultConditionName="
+ info.resultConditionName
+ "&resultConditionValue="
+ info.resultConditionValue
+ "&resultTitle="
+ info.resultTitle
+ "&resultDate=" + info.resultDate;
fm.submit();
}
在QueryToExport这个页面中:<%@page contentType="text/html;charset=gb2312" %>
<%@page import="com.sinosoft.utility.VData"%>
<%
try{
String tResult = request.getParameter("result");
String tResultHead = request.getParameter("resultHead");
String tResultConditionName = request.getParameter("resultConditionName");
String tResultConditionValue = request.getParameter("resultConditionValue");
String tResultTitle = request.getParameter("resultTitle");
String tResultDate = request.getParameter("resultDate");
这里的tResult 总是空值,我这个在jsp页面上已经把隐藏了result,导出的Excel也已经给赋值过了为什么就是没有导出呢?