Share on Google+Share on Google+

Pagination Example

In this tutorial you will learn about the pagination in the struts framework

Rich Editor Example


In this section, you will learn how to create pagination in struts 2. For creating pagination in your application follows the certain steps:

Download this code

Step 1: Create index.jsp page

Here is the code to be added in the index.jsp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>RoseIndia.Net Struts 2 Tutorial</title>

<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="400">
<td><font size="5"><b> Struts 2 Tutorials</b><br>
<td><font ><b>Select the following links to test the

<li><a href="roseindia/pagination.action">Pagination Example</a></li>

<td><font >&nbsp;<br>
Visit <a href=""></a>
for latest tutorials</font></td>
<p align="center">&nbsp;</p>

Step 2: Create an action mapping in the struts.xml file. 

Here is the code to be added in the struts.xml:

<?xml version="1.0" encoding="UTF-8" ?>
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

<!-- Rose India Struts 2 Tutorials -->
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />

<package name="roseindia" namespace="/roseindia" extends="struts-default">

<action name="pagination">


<!-- Add packages here -->


Step 3: Create a JSP page that contains pagination code:

Here is the code to be added in the pagination.jsp:

<%@ taglib prefix="s" uri="/struts-tags" %>


<title>Pagination Example</title>
<s:head theme="ajax" />

<s:textarea name="text" label="Paste your text here" theme="ajax" 
cssStyle="background-color: #FCFCFC; border: 1px solid #A0A0A0; min-height:500px; max-height:inherit; "/>






Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Pagination Example  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image