错误挂毯使用数据网格2 [英] error tapestry using data gridsource 2
问题描述
Continuing tutorial I have came across an error. previous problem seems to be fixed.
教程说:
要使用创建的CelebritySource,请将以下方法添加到ShowAll页面类:
tutorial says: To make use of the created CelebritySource, add the following method to the ShowAll page class:
public GridDataSource getCelebritySource()
{
return new CelebritySource(dataSource);
}
然后更改ShowAll.tml模板中Grid组件的源参数: / p>
Then change the source parameter of the Grid component in ShowAll.tml template:
<t:grid t:source="celebritySource" rowsPerPage="5"
row="celebrity" t:model="model">
运行应用程序。登录以查看ShowAll页面,一旦显示名人表,您应该看到以下输出:
Run the application. Log in to view the ShowAll page, and as soon as the table with celebrities is displayed, you should see the following output:
准备选择。
从0到4的索引
属性名称为:null
排序升序:true
获取行0的值
获取第1行的值
获取第2行的值
获取第3行的值
获取第4行的值
Preparing selection. Index from 0 to 4 Property name is: null Sorting order ascending: true Getting value for row 0 Getting value for row 1 Getting value for row 2 Getting value for row 3 Getting value for row 4
页面有错误:
发生意外的应用程序异常。
An unexpected application exception has occurred.
异常组合页面的根组件ShowAll:无法转换
'model'转换成一个组件参数绑定:异常生成
导航表达式'模型':类
org.apache.tapestry.pages.ShowAll不包含属性(或
公共字段)命名为'model'。
Exception assembling root component of page ShowAll: Could not convert 'model' into a component parameter binding: Exception generating conduit for expression 'model': Class org.apache.tapestry.pages.ShowAll does not contain a property (or public field) named 'model'.
删除t:model =modelfrom t:grid
After deleteing t:model="model" from t:grid
页面有错误:
发生意外的应用程序异常。
An unexpected application exception has occurred.
SetupRender [ShowAll:grid]中的渲染队列错误:索引:0
Render queue error in SetupRender[ShowAll:grid]: Index: 0
任何人都有这个问题?
推荐答案
这个例子似乎缺少一些代码。尝试将以下内容添加到页面 ShowAll.java
:
Seems the example was missing a bit of code. Try adding the following to the page ShowAll.java
:
@Inject
private BeanModelSource beanModelSource;
@Inject
private Messages messages;
public BeanModel<Celebrity> getModel() {
return beanModelSource.createDisplayModel(Celebrity.class, messages);
}
从 T5网格组件参考:
用于标识要呈现的属性和呈现顺序的模型。
The model used to identify the properties to be presented and the order of presentation.
上述应该根据公共方法和属性创建一个默认的BeanModel。
The above should create you a default BeanModel, based on public methods and properties.
这篇关于错误挂毯使用数据网格2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!