简体   繁体   English

读取从Java Servlet返回的大型JSON数据

[英]Read large json data returned from java servlet

Servlet returns about 4000 rows as json object. Servlet返回约4000行作为json对象。

Without any processing in javascript, browser is not responsive for a second or two. 如果不使用JavaScript进行任何处理,浏览器将在一两秒钟内没有响应。 When that data is processed in "for loop" ...not responsive for about 4 seconds. 在“ for循环”中处理该数据时...约4秒钟没有响应。

Is that json object to large for browser to handle...even without processing is not responsive? 该json对象是否大到浏览器可以处理...即使不进行处理也不响应的情况?

Any idea how to solve that?...Thanks. 知道如何解决吗?...谢谢。

If it is slower than you are happy with, you're probably going to have to chunk the data. 如果它慢于您满意的速度,则可能必须对数据进行分块。

Only fetch the data that is going to be showed on page load and then request the rest as needed. 仅获取将在页面加载时显示的数据,然后根据需要请求其余数据。 If it's for a grid, load the first 20 records and then retch what is needed per request. 如果是用于网格,请加载前20条记录,然后提取每个请求所需的内容。

If you need ALL of the data 1) only fetch the data that shows on the page 2) load the rest of the data in the background 3) merge the data behind the scenes 如果您需要所有数据1)仅获取页面上显示的数据2)将其余数据加载到后台3)将数据合并到幕后

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM