JSF can do the data scroller by using the dataScroller, and the use this comparator for sorting and pass back the list to dataScroller.
Comparator comparator = new Comparator()
{
public int compare(Object o1, Object o2)
{
Account e1 = (Account)o1;
Account e2 = (Account)o2;
if (column == null )
{
return 0;
}else
if (column.equals("AccountID"))
{
if (e1.getIdAcct() == null){
return 1;
} else if (e2.getIdAcct() == null){
return 0;
}
return isAscending() ? e1.getIdAcct().compareTo(e2.getIdAcct()):e2.getIdAcct().compareTo(e1.getIdAcct());
}