Tapestry 5.2.6 的 Onkeyup 事件

Onkeyup Events with Tapestry 5.2.6

我正在尝试使用 Tapestry 的 mixins zoneUpdater 在我在文本字段中写入时触发事件。但是我不断收到以下错误:

Failure creating embedded component 'myComponent' of com.mycompany.myapp.web.pages.tapestryTest.testEdit: Unable to resolve 'zoneUpdater' to a mixin class name.

这是 tml 页面中的代码:

<div t:type="zone" t:id="myZone" id="myZone" update="show">
<table><tr>
    <td class="td-right-view"><t:label for="myComponent"/></td>
    <td class="td-left-view"><t:textfield t:id="myComponent"
    value="myValue" t:validate="maxlength=8" maxlength="8"
    style="width:70px;" t:mixins="zoneUpdater" t:clientEvent="keyup" 
    t:event="updateMyValue"  t:zone="myZone"/></td></tr>
</table
</div>

在控制器中我定义了以下方法:

@OnEvent(component = "updateMyValue")
Object onupdateMyValue()
{
    if (this.value.length()==8){
        //does something
    }

    return myZone.getBody();
}

知道为什么我总是遇到这个问题吗?我正在做与 jumpstart 相同的事情,但出于某种原因它无法识别 zoneUpdater。我正在使用 Tapestry 5.2.3,因此它应该可以在不从 Jumpstart 创建 类 的情况下工作。

提前致谢, 雷米

Tapestry 本身没有名为 ZoneUpdater 的 mixin。 Jumpstart 页面上描述的那个(例如,http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/onevent)是一个自定义的。请参阅 link 以获取源代码。只需将该代码粘贴到您的项目中即可。