我想为我的应用程序的某些类应用分页,其中我使用的是 spring、struts2 和 hibernate。在这里,我从welcome.jsp 文件中调用动作类。它有以下代码:
<s:form action="marketing/allCountry.action">
<s:submit value="Click"></s:submit>
</s:form>
现在我allCountry.action
的java类有以下代码:
public String executeAction() throws Exception {
try {
countryList = new ArrayList<Country>();
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;
}
}
它正确地获取数据,我通过打印 countryList 对象确认。但现在我从 重定向SUCCESS
到country.jsp
。的代码country.jsp
是:
<display:table list="countryList" requestURI="CountryAllAction" pagesize="3">
<display:column property="id" title="ID" />
<display:column property="name" />
</display:table>
现在在执行我的应用程序时,我遇到了运行时错误,例如:
javax.servlet.ServletException:javax.servlet.ServletException:异常:[.LookupUtil] 在对象类型“java.lang.String”中查找属性“id”时出错。原因:未知属性 'id'
此类错误的解决方案是什么?