0

When sending large data from JavaScript to the Spring controller, I am getting null in controller. If I send small data it works perfectly. I am using post request, I can't figure out why large data is not getting passed through. Any other way this can be achieved?

//controller method

public void exortExcel(HttpServletResponse response, HttpServletRequest request,
@RequestParam(value = "exceldata", required=false) String excel,
@RequestParam(value = "filename", required=false) String fileName
)
{
String[] rows = excel.split("\n);

}
//js

var sendDataForm = $(
                '<form action=/lrgdata/exprt.html method="POST" >'
                + '<textarea name="exceldata">' + data + '</textarea>'
                + '<input type="text" name="filename" value =' + fileName '/>'
                + '<input type="submit" value="submit" />'
                +'</form>').hide();
                
                $("#" + divID).append(sendDataForm);
                $(sendDataForm).trigger("submit");
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
rabbit
  • 45
  • 5
  • How big is the data you're trying to send? – Anton Oct 05 '20 at 16:06
  • Does this answer your question? [Can HTTP POST be limitless?](https://stackoverflow.com/questions/2880722/can-http-post-be-limitless) – Anton Oct 05 '20 at 16:07
  • @Anton I am using JQGRID and it has around 27000 records. – rabbit Oct 05 '20 at 16:17
  • =) no such measurement as "records". We use "bytes". Add this line before `var sendDataForm = $(` to your code: `console.log('Size =', String(data).length)`. It will show the data size in the console – Anton Oct 05 '20 at 16:40
  • @Anton size=23066775 – rabbit Oct 05 '20 at 18:15
  • Well, not so very big, but at the same time not a "small". You have to figure out where is the limit (an which one 20Mb? 10Mb? 5Mb? 1Mb? any other?) - in a browser or in backend. So you can detect min.size for your browser (let for example it be 20Mb, but 19Mb is working good), then check in other browsers if they have the same limits. – Anton Oct 05 '20 at 18:26

0 Answers0