ZK Pivottable is a data summarizing component; taking a flat table as raw data and organizes the data into desired categories arranged by columns and rows. It brings the power of spreadsheet’s pivot table functionality to Java web applications.
This blog post will demonstrate how ZK Pivottable can be used inside a JSP page.
Setting up the environment
Before using ZK Pivottable in your JSP pages, the web application would need some libraries installed. web.xml would also need to be configured to include a special servlet to handle the AJAX interactions with the pivottable component. Please refer to this article for more details.
Embedding Pivottable inside a JSP page
Here is a sample JSP page that uses ZK Pivottable. For brevity, only the relevant lines are shown.
ZK Pivottable is utilized inside a JSP page via JSP custom tags. Please read here for more information on working with JSP tags defined by ZK.
Embedding ZK Pivottable inside a JSP page is only half the story. Without data, the pivottable is pretty much useless. Hence, a controller class would also need to be written. This article describes what the controller class might look like.
The complete source code for a sample application is available on github.