0

I am having a very wierd issue and I'm hoping you can help me out

At work, we use a web application made with the framework GWT, and all the sales reports have an option to export the data to excel. It usually works fine, but the days that the report has more than about 15-20 thousand rows, the excel file only opens with the word "null" on the first cell. Within the code, we use a JSP to send the data as html and a StringBuffer object to append all the text of the html. Here es the method that sends the html:

 public void export(final String psFormat) {
    manageStartOfCall();
    String lsFileName = "resources/system/excel_file.jsp";
    final DynamicForm loForm = new DynamicForm();
    loForm.setAction(lsFileName);
    loForm.setMethod(FormMethod.POST);
    loForm.setCanSubmit(true);

    final TextAreaItem loDataToExport  = new TextAreaItem("psExcelData");
    final Window  loExcelWindow = new Window();
    loExcelWindow.setWidth(5);
    loExcelWindow.setHeight(5);
    loExcelWindow.addItem(loForm);
    addChild(loExcelWindow);

    new Timer() {
        public void run() {
            cancel();                
            loDataToExport.setValue(moHeader.getHeaderAsExcel()  + "<br><br>" + moReportGrid.getDataAsHTML());                
            loForm.setFields(loDataToExport);

            new Timer() {
                public void run() {
                    cancel();
                    manageEndOfCall();
                    loForm.submit();
                    loExcelWindow.destroy();
                }
            }.schedule(200);

        }
    }.schedule(200);
} 

I've already debugged the getDataAsHTML method and the string that it returns is fine, it contains the correct HTML, however when I call the method getParameter in the JSP y returns a null value. Here the code of the JSP:

<%
   response.setContentType("application/vnd.ms-excel");
   response.setHeader("Content-Disposition", "attachment;filename=eYumReport.xls");

       String msDataToExcel = request.getParameter("psExcelData");           
%>

<html>
    <head>
        <title>Data to excel</title>
    </head>
    <body>
        <%=msDataToExcel %>
    </body>
</html>

I may have to mention I am using this on Firefox 26, GWT 2.1, smartGWT 2.4, Windows 7 Professional and the Web application is on Windows Server 2008, mounted on Apache 6. Any ideas why this is happening??

HanselDoullery
  • 197
  • 3
  • 15
  • Are you sure you're setting this *psExcelData* as request parameter (e.g. a query string parameter in a GET request) or as request attribute before forwarding to this JSP? – Luiggi Mendoza Feb 05 '14 at 15:26
  • sounds like an out of memory error. Perhaps an increased buffer, or a [multipart](http://docstore.mik.ua/orelly/java-ent/servlet/ch04_04.htm#ch04-20158) request? – SeanC Feb 05 '14 at 15:42
  • Yes it was something like that. This thread has the answer I needed http://stackoverflow.com/questions/2943477/is-there-a-max-size-for-post-parameter-content All I had to do is change the parameter in the server to a larger parameter, in the file server.xml inside the folder of my tomcat instance. Thank you for you answer! – HanselDoullery Feb 05 '14 at 16:13

0 Answers0