【发布时间】:2010-10-21 02:28:43
【问题描述】:
我想为我的应用程序的某些类应用分页,其中我使用的是 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] 在对象类型中查找属性“id”时出错 “java.lang.String”。原因:未知属性 'id'
此类错误的解决方法是什么?
【问题讨论】: