I have connected to one MySql table to fetch 1000 records that need to be displayed using JSP. I want to split my table into multiple tables (of size 50) which can be viewed by using next button on jsp page. How can I implement it?
String sql = "select * from people";
PreparedStatement statement = connection.prepareStatement(sql);
ResultSet result = statement.executeQuery();
while(result.next()) { // here i get 1000 records. how can i display these records on mulitple jsp pages?
// ... get column values from this record
}
Above gives 1000 records and I use a PreparedStatement.
Assuming you can fetch the complete table in JSP.
Just add one more param to the function returning the ROWS
COUNTERAdd COUNTER to
LIMITclause in your QUERY.Now you need to keep track of the
COUNTERso Update the URL on click on next asFetch the
pageCOUNTERvaraible from URL and pass it to your function as COUNTERAnd so on. Keep getting you result.
OR USE JAVASCRIPT TABLE – http://www.datatables.net/