Tuesday, February 11, 2014

Display tag Pagination, Sorting Example in JSP and Servlet

If you are a Java programmer, writing JSP pages for your web application and doesn't know much about JavaScript, jQuery, CSS and HTML, then display tag is best for creating dynamic tables, pagination, sorting, and exporting data into PDF, Word and Excel format. Display tag is a JSP tag library, where code is written in Java but you can use them like HTML tags e.g. <display></display> . Though display tag is old library, I have always used in JSP for displaying tabular data. It comes with sample CSS as well, which is good enough for many applications. Long time back, I have shared some display tag tips and example, and many of my reader asked me to write about how to do pagination and sorting in JSP page. I haven't really got chance to work on JSP after that, so it took me so long to share this display tag pagination and sorting example tutorial. Anyway, In this tutorial we will not only learn about pagination and sorting but also learn how to display multiple tables using display tag in one JSP file. There is a non obvious detail, which can trouble you if you are also like many programmers, who write code by copying, including me :). If you create another table by just copying the table already exists in page, it may not work, until you remember to provide two different ids or uids. In absence of unique identifier like this, any pagination or sorting activity on one table will also disturb other table. So always remember to provide unique id or uid to each table, created by display tag in same page.
Read more �

No comments:

Post a Comment