Have JSP page with dynamically generated HTML table with unknown number of rows.
Have property on backend, that sets maximum number of rows, e.g: max_rows=15
Edit: This doesn't actually solve the problem proposed. I missed the part in the question that the user needs to be able to scroll to see the rest of rows. Whoops. So, I suppose js is actually needed.
This can actually be done without javascript. The trick is using nth-child(x)
:
table {
border-collapse: collapse;
}
tr:nth-child(n + 4) {
visibility: hidden;
}
The border-collapse is needed so the border doesn't extend beyond the hidden rows.
Here's the fiddle.