i'm working with struts 1.3 project with jsp file that works as to extract the Excel file, but i get error when the data in excel file is huge i.e more than 10000.
here is the code snippet with error :
Below is the error :
HTTP Status 500 - An exception occurred processing JSP page /pages/console/popUpExcell.jsp at
line 14
________________________________________
type Exception report
message An exception occurred processing JSP page /pages/console/popUpExcell.jsp at line 14
description The server encountered an internal error that prevented it from fulfilling request.
exception
org.apache.jasper.JasperException:Feb 25, 2014 6:20:33 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/project] threw exception [An exception occurred processing JSP page /pages/console/popUpExcell.jsp at line 15 11:
12: String cadena = request.getParameter("cadena");
13: System.out.println("cd="+cadena);
14: cadena=cadena.replaceAll("<INPUT type=checkbox name=validar>","");
15: response.containsHeader("application/vnd.ms-excel");
16: response.setContentType("application/vnd.ms-excel");
17: response.setHeader ("Content-Disposition", "attachment;filename=file1.xls");
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)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
root cause
java.lang.NullPointerException
org.apache.jsp.pages.console.popUpExcell_jsp._jspService(popUpExcell_jsp.java:84)
Here error occurs when there is huge data i.e. more than 10000. but if the data is less than it works properly.
i.e when list of data is more String cadena = request.getParameter("cadena") gives me null and when list of data is less then works properly
file popUpExcell.jsp
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ page contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%
String cadena = request.getParameter("cadena");
System.out.println("cd="+cadena);
cadena=cadena.replaceAll("<INPUT type=checkbox name=validar>","");
response.containsHeader("application/vnd.ms-excel");
response.setContentType("application/vnd.ms-excel");
response.setHeader ("Content-Disposition", "attachment;filename=file1.xls");
%>
<table border="1" bordercolorLight="blue" cellspacing="0" cellpadding="2" style="border: solid #000000; background color:#ffffff;table-layout:auto;">
<tr bgcolor="#333399">
<td align="center"class="Text222" width="20" > </td>
<td align="center" width="70" class="blanco"><bean:message key="menu"/></td>
<td align="center" width="90" class="blanco"><bean:message key="menu.type"/></td>
<td align="center" width="200" class="blanco"><bean:message key="menu.location"/></td>
<td align="center" width="200" class="blanco"><bean:message key="menu.detail"/></td>
<td align="center" width="170" class="blanco"><bean:message key="menu.customer"/></td>
<td align="center" width="200" class="blanco"><bean:message key="menu.zipcode"/></td>
<td align="center" width="180" class="blanco"><bean:message key="menu.destination"/></td>
<td align="center" width="110" class="blanco"><bean:message key="menu.status"/></td>
<td align="center" width="90" class="blanco"><bean:message key="menu.Logdate"/></td>
<td align="center" width="170" class="blanco"><bean:message key="menu.vendor"/></td>
</tr>
</table>
<%=cadena %>
i'm using a javascript function i.e on click of a button export excel appers :
function fnCopyReportTable()
{
cadena=frames.frameId.document.all.listTable.innerHTML;
alert(cadena); // here it displays HTML DOM
document.form1.cadena.value=cadena;
form1.action="<%=request.getContextPath()%>/pages/file/popUpExcell.jsp";
form1.submit();
}
Here the list contains export to excel sheet. But this above problem i face when <%=cadena%>
contains large data.
cadena refers HTML DOM in it.
want to solve the error when there is large data in it.