Applying page state to jsps, refactoring pagination