开发者

JBoss Seam - Dealing with large data returned from SQL

开发者 https://www.devze.com 2023-04-09 10:54 出处:网络
I\'m looking for techniques/best-practices to do deal with the way our web-based application works. Currently when a user searches a field it can returns more than 10000 records at once which to me i

I'm looking for techniques/best-practices to do deal with the way our web-based application works.

Currently when a user searches a field it can returns more than 10000 records at once which to me is a waste of bandwidth and memory.

Is there a way to limit the number of returned rows based on the numbers of rows selected to display. i.e. if on the web page user selects 100 rows per page then only return the 100 rows instead of loading all 10000 at once , then when next-page is clicked the next 100 number of rows will be loaded 开发者_运维问答and so on.

UPDATE : The current implementation fetches all the data, binds it to the t:datatable and t:dataScroller for navigation between the pages.

From my reading in JFS 1.1 there is no server-side pagination provided (Correct me if i'm wrong) and to provide such mechanism i need to write custom code such as http://wiki.apache.org/myfaces/WorkingWithLargeTables

Can someone confirm is this is a good solution? Using RichFaces is not an option.

thanks


You should do server-side pagination using a jsf component, as an example in richfaces:

http://katzmaier.blogspot.com/2010/03/richfaces-server-side-pagination.html


Could you use a Paginator component to control the display of the relevant number of records?

If you need to restrict the number of rows returned this can be specified as part of your query syntax.


Take a look at the entityquery class. This one supports already server-side pagination and sorting. It works well with simple or richfaces datatables. Even jquery datatables on top of the plain jsf one is possible if you need some lightweight stuff.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号