I want to apply pagination for some class of my application, in which i am using spring, struts2 & hibernate. Here i am calling action class from welcome.jsp file. It ha
Use the following code.Instead of list attribute use name attribute.
<display:table name="countryList" requestURI="CountryAllAction" pagesize="3">
<display:column property="id" title="ID" />
<display:column property="name" />
</display:table>
You need make "countryList" available to DisplayTag, e.g. by doing something like:
request.setAttribute("countryList", countryList);
in your action (unless there's a cleverer Struts2 way of doing this). I think you can get hold of the request in your action by making it implement ServletRequestAware
You also need to make sure that your Country class has id and name properties.
You need to have a getter for your countryList in your action.
List<Country> countryList = new ArrayList<Country>();
public String executeAction() throws Exception {
try {
countryList = this.countrySecurityProcessor.findByAll(0, null, null, null, null, false, false, null, null, null, null, 0);
System.out.println("countryList = "+countryList);
return ActionSupport.SUCCESS;
} catch (Exception ex) {
return ActionSupport.ERROR;
}
}
public List<Country> getCountryList() {
return countryList;
}
u dont need to do any thing just use list variable in display tag name i.e
<display:table name="yourListnameinaction">
</display>
I'm not familiar with Struts2 but it seems that DisplayTag can't find your countryList in any scope.
I don't see you putting countryList in from or request. If I'm not right may be you need to specify form name like
<display:table list="${yourStrutsFormName.countryList}" ...