Linked Questions

Popular Questions

DisplayTag in Struts2 for pagination

Asked by At

I want to apply pagination to my struts2 web application. When the user logs in, I am redirecting them to the home page, on which I want to display all the users in pagination using the display tag.

I've done research and finally integrated this in my struts2, but when I run the code after login it displays the message Nothing found to display.

When I've done the same thing in struts1.3 by taking example from this site it is working. I have copied the following JAR files to my lib folder:


I have also copied displaytag.tld and struts-2.17.dtd to my web-inf folder.

Below is my code:

my profile.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@taglib uri="" prefix="display" %>
<%@taglib uri="/struts-tags"  prefix="s" %>
    <div id="wrapper">
        <div id="steps">
            <fieldset class="step">
                <display:table id="data" name="list" requestURI="/display.action" pagesize="1" >
                    <display:column sortable="true">
                            <label for="username">User Name</label>
                            <input id="username" name="username" value="<s:property value="firstName" />" disabled="disabled"/>
                            <label for="email">Father Name</label>
                            <input id="email" name="email" value="<s:property value="lastName"/>" disabled="disabled" />
                            <label for="password">Age</label>
                            <input  name="password" value="<s:property value="dob"/>" disabled="disabled"/>
                            <label for="address">Address</label>
                            <input name="address"  value="<s:property value="emailID"/>" disabled="disabled"/>


<action name="display" class="">
        <result name="success">/profile.jsp</result>
        <result name="errror">/error.jsp</result>

private ArrayList<UserBean> list=new ArrayList<UserBean>();
//setter getter 
public String execute()
    UserBean rt=new UserBean();
    SearchDB user=new SearchDB();
    return SUCCESS;

public class UserBean {

private String emailID;
private String userName;
private String gender;
private String dob;
private String firstName;
private String lastName;
private int Id;
//setter and getter

//code to get records. their is no problem here because it is taking records out from db fine.

I am not sure, but my guess is requestURI and name attribute in displaytag because in the example linked above, they are using name="sessionScope.UserForm.userList". Would someone please tell me where I did wrong?

Related Questions