Struts 1 eXtremeTable Example

 

The eXtremeTable is a JSP tag library used to display data in an HTML table format. It supports the following features:
– Pagination
– Column sorting
– Multi-column filtering
– Exporting data to PDF, Excel, CSV …
– ..

In this tutorial, we will see how to use the eXtremeTable in a Struts 1 application to display data in an HTML table.

 

1. Technologies used

  • Struts 1.3.10
  • Extremecomponents 1.0.1
  • Eclipse 4.4
  • JDK 1.6
  • Tomcat 6.0

 

2. Project structure

We use Eclipse to create a new “Dynamic Web Project”

Struts 1 eXtremeTable Example

 

3. Project libraries

We add the required libraries to the WEB-INF/lib folder :

Struts 1 eXtremeTable Example 1

 

4. Struts tlds

To use the eXtremeTable tag in JSP pages, we need to add the following tld :

Struts 1 eXtremeTable Example 2

You can retrieve it from the extremecomponents-1.0.1.jar library.

 

5. Struts Action

Prepare data to be displayed in the data table.

 

6. Model class

The attributes in this class must match the properties in the data table columns in JSP page.

 

7. JSP pages

index.jsp : home page.

 

display.jsp : contains the data table.

We have used the <ec:table ../> tag to create a dynamic HTML table and we have enhanced the table features to allow filtering, paging sorting, exporting data ..etc.

 

8. CSS & Images

To construct the data table view.

Struts 1 eXtremeTable Example 3

 

9. Struts config file

File : struts-config.xml

 

10. web.xml

We need to add the extremecomponents taglib and the eXtremeExport filter.

File : web.xml

 

11. Test It

URL : http://localhost:8080/Struts1-eXtremeTable-Example/

Struts 1 eXtremeTable Example 4

We have a dynamic HTML table that allows paging, sorting, filtering, changing page length, exporting data ..etc.

 

Export data to PDF :

Struts 1 eXtremeTable Example 5

Export data to Excel :

Struts 1 eXtremeTable Example 6

 

Export data to CSV :

Struts 1 eXtremeTable Example 7

 

Download source code