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....
精彩评论