Inside your JSP is not a good place to solve the whole problem. In a typical layered approach, you separate the presentation (JSP here) from data access (where you make your request).
Your displaytag / jsp tag should go to the data access level that it wants (for example, I need the next 30 and I'm on page 5), and then your data access level will process the broken request.
source
share