Java tapestry使用数据gridsource 2时出错
我遇到了一个错误。 以前的问题似乎是 教程说: 要使用创建的CelebritySource,请将以下方法添加到ShowAll页面类:Java tapestry使用数据gridsource 2时出错,java,datagrid,error-handling,tapestry,Java,Datagrid,Error Handling,Tapestry,我遇到了一个错误。 以前的问题似乎是 教程说: 要使用创建的CelebritySource,请将以下方法添加到ShowAll页面类: public GridDataSource getCelebritySource() { return new CelebritySource(dataSource); } 然后在ShowAll.tml模板中更改网格组件的源参数: <t:grid t:source="celebritySource" rowsPerPage="5" row="celebri
public GridDataSource getCelebritySource()
{
return new CelebritySource(dataSource);
}
然后在ShowAll.tml模板中更改网格组件的源参数:
<t:grid t:source="celebritySource" rowsPerPage="5"
row="celebrity" t:model="model">
运行应用程序。登录以查看ShowAll页面,一旦显示名人表,您将看到以下输出:
准备选择。
索引从0到4
属性名为:null
排序顺序升序:true
正在获取第0行的值
获取第1行的值
获取第2行的值
获取第3行的值
获取第4行的值
页面有错误:
发生意外的应用程序异常
组装页面ShowAll的根组件时出现异常:无法转换
将“模型”绑定到组件参数绑定中:生成异常
表达式“model”的管道:类
org.apache.tapestry.pages.ShowAll不包含属性(或
公共字段)命名为“模型”
从t:grid中删除t:model=“model”后
页面有错误:
发生意外的应用程序异常
SetupRender[ShowAll:grid]:索引:0中出现渲染队列错误
有人遇到过这个问题吗?这个示例似乎缺少一些代码。尝试将以下内容添加到页面
ShowAll.java
:
@Inject
private BeanModelSource beanModelSource;
@Inject
private Messages messages;
public BeanModel<Celebrity> getModel() {
return beanModelSource.createDisplayModel(Celebrity.class, messages);
}
@Inject
专用BeanModelSource BeanModelSource;
@注入
私人信息;
公共BeanModel getModel(){
返回beanModelSource.createDisplayModel(名人.class,消息);
}
从:
用于确定要呈现的属性和呈现顺序的模型
以上内容应基于公共方法和属性为您创建默认BeanModel。这改进了解决方案。但是,现在显示的错误与我从t:grid页面删除t:model=“model”时的错误相同,错误:>发生了意外的应用程序异常。>>SetupRender[ShowAll:grid]:索引:0中出现渲染队列错误