简体   繁体   English

JSF2中ArrayList的分页

[英]Pagination for ArrayList in JSF2

I have one searched arraylist that i am getting from Database for that array list i want to apply paginataion with links First, Prev, Next, Last and Goto page dropdown here i don't want to call database for every request(ie First,Prev,etc) i want to use arrylist that returned at the time of search.And one more requirement is field level sorting need to do Ascending,descending if user clicks on header field.can any one help me to fix this i want to use only JSF2 no RichFaces,etc 我有一个搜索数组列表,该数组列表是我从数据库中获取的该数组列表,我想应用带有链接“首页”,“上一页”,“下一页”,“最后一页”和“转到”页面下拉列表的分页,在这里我不想为每个请求都调用数据库(即“首页”,“上一页” ,etc)我想使用搜索时返回的arrylist。另一个要求是字段级排序需要升序,如果用户单击标题字段,则降序。任何人都可以帮助我解决此问题,我只想使用JSF2没有RichFaces等

Thank in advance. 预先感谢。

Why do you not want to use rich or prime faces or others? 您为什么不想使用有色或素面的面孔或其他? Just use primefaces datatable with paginator="true". 只需使用带有paginator =“ true”的primefaces数据表。

If you don't want it, but want to do it the hard way. 如果您不想要它,但是想用困难的方式做。 I suggest you fetch everything from database. 我建议您从数据库中获取所有内容。 Use a datatable and in the getter of that table, you only give back a portion of your array. 使用一个数据表,在该表的getter中,您只退还一部分数组。 (index 10 to 20, or index 20 to 40 or...) On top or bottom of your datatable you put some outputlinks. (索引10到20,或索引20到40或...)在数据表的顶部或底部放置一些输出链接。 These can set the indexes you want to retrieve. 这些可以设置您要检索的索引。

Hope my explanation is clear. 希望我的解释清楚。

In case Myfaces Tomahawk is an option for you... 万一Myfaces战斧是您的选择...

I see it (Myfaces Tomahawk) as a bit different from PrimeFaces/Richfaces cause MyFaces are responsible for the MyFaces JSF Implementation as well (so it could be an excuse for using Myfaces Tomahawk), so you can use the Myfaces JSF implementation + Myfaces Tomahawk 我认为它(Myfaces Tomahawk)与PrimeFaces / Richfaces有点不同,因为MyFaces也负责MyFaces JSF实现(因此这可能是使用Myfaces Tomahawk的借口),因此您可以使用Myfaces JSF实现+ Myfaces Tomahawk

Take a look at the Myfaces Tomahawk datascroller 看看Myfaces战斧数据滚动器

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

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