开发者

jsf datatable limiting user result

开发者 https://www.devze.com 2022-12-17 07:39 出处:网络
I was wondering how could I be able to show users warning or information to refine the search if their search result exceeds 100. For example: if the search results are more than 100 then disp开发者_J

I was wondering how could I be able to show users warning or information to refine the search if their search result exceeds 100. For example: if the search results are more than 100 then disp开发者_JAVA技巧lay only hundred and show users warning to refine the search, in JSF/datatable.

Any help would be highly appreciated. Thanks


You can do the following:

  • limit the list size in your managed bean. Preferably, set a limit to the SQL result (or whatever persistence mechanism you are using)
  • set a boolean shouldRedefineCriteria (in the managed bean) in case the result is bigger than 100. If you have limited the SQL result, you can safely specify:

    shouldRedefineCriteria = result.size() >= 100;
    
  • in your jsf page output:

    <h:outputText value="Redefine your criteria" 
         rendered="#{managedBean.shouldRedefineCriteria" />
    


query.setMaxResults(4);

I think i got it.

Thanks....

0

精彩评论

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

关注公众号