开发者

jsf datatable limiting user result

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜