Struts pagination DataTables

Struts pagination DataTables

This demo you will see how to create pagination using DataTables for Struts 2 application. DataTable is plug-in basically for jQuery. For more information about DataTables please go here:

Tools needed:

  • Eclipse 3.4 or above (Download from here) – Note for this demo we have used eclipse Kepler
  • JDK 1.5 or above (Download from here )
  • Tomcat 6 or above (Please follow link to install and configure tomcat in eclipse: Configure and Run Tomcat server in eclipse )
  • Maven 3.0.4
  • struts2-json-plugin (Dependency already included in pom.xml)
  • DataTables CSS,JS which you can get it directly form its site here (Links are already included in jsp page you don’t need to download anything)
  • JQuery js file (Links are already included in jsp page you don’t need to download anything)

Final Struts 2 pagination screen you will see after all configuration as below: 

Struts pagination DataTables

Steps:

  • Create maven project name: Struts2PaginationDatatables
  • Final project structure:

Struts pagination DataTables

  • pom.xml file dependency:

  • web.xml

  • index.jsp:

  • StrutsPaginationAction.Java

  • PersonJsonObject.java

  • Person.java

  • Run this set up in tomcat server. If you didn’t configure tomcat set up in eclipse yet please use this tutorial: Configure and Run Tomcat server in eclipse. Now right click project –>Run As –> Run on server you will see below pagination screen:

Struts pagination DataTables

  •  Search filter with name:

Struts 2 pagination DataTables

download Download Project:  Struts2PaginationDatatables

That’s it Struts 2 pagination DataTables

4 thoughts on “Struts pagination DataTables

Leave a Reply

Your email address will not be published. Required fields are marked *