在单个jsp页面中加载大量记录的性能问题 [英] performance issue to load huge records in a single jsp page

查看:165
本文介绍了在单个jsp页面中加载大量记录的性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在StringBuffer中存储了大量(超过20000条)记录,以便在jsp中显示。我使用StringBuffer存储在servlet中,并将其作为请求属性传递给jsp。问题是加载所有记录需要太多时间。加载后,浏览器变慢了。有没有最好的方法在单个jsp页面中加载大量记录?或者如何快速地从StringBuffer读取数据?

I stored huge(above 20000) records in StringBuffer for displaying in a jsp. I used StringBuffer to store in servlet and pass this as request attribute to jsp. The problem is that it takes too mush time to load all the records. After loaded, the browser is getting slow. Is there any best way to load huge records in a single jsp page ? or otherwise how to read data from StringBuffer fastly?

推荐答案

我很确定问题不是来自StringBuffer或来自JSP生成的HTML代码。问题可能来自:

I'm pretty sure the problem doesn't come from the StringBuffer or from the HTML code generation by the JSP. The problem probably comes from:


  • 从数据库加载所有这些信息所需的时间

  • 将巨大的HTML页面从服务器传输到客户端所需的时间。带宽不是无限制的

  • 浏览器解析和呈现巨大HTML页面所需的时间

无论如何,我非常怀疑用户能够在包含20000条记录的页面中找到他感兴趣的内容。提供搜索界面而不是显示所有内容,并且一次只显示20,50或100条记录的页面,就像每个网站一样(想想Google:结果页面中没有显示所有结果,但只有少数首先显示)。

Anyway, I very much doubt a user will be able to find what he's interested about in a page containing 20000 records. Provide a search interface rather than showing everything, and only display pages of 20, 50 or 100 records at once, like nerly every web site does (think Google: all the results are not displayed in the result page, but only the few first ones).

这篇关于在单个jsp页面中加载大量记录的性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆