I have search and results displayed on the same jsf. The results are been displayed using rich:dataTable. I have pagination successfully implemented.
(Display 15 rows on each page)
My problem comes when on a search I get results back with (let's say) 10 pages. If I go on let's say the 7th page and do a new search without refreshing the page if the new search has results with 7pages the datatable will be showing the 7th page and not the 1st. (like for a new search)
If on the second search the results are less then 7 pages it will show the last page (if there are 4 pages it will show the 4th)
if the second search has only one page it will show that one page.
Going from a search with a less results to a search with more the same happens. If I open the 4th page and the new search has more pages then this search the 4th page will be opened instead of the 1st one.