![](/img/trans.png)
[英]Wicket - get the selected item in the DropDownChoice using Scala
[英]Wicket - get the value of a textbox filled using scala
我正在嘗試檢索如下所示的TextField的值:
item.add(new TextField("description", new Model[String]() {
override def getObject(): String = {
customer.description = ??? // I don't know how I can get the value here
return ...
}
}))
我將這個TextField插入到ListView中,並且需要使用TextField值在屬性模型中進行設置。
謝謝
首先,您需要將新值發送到服務器,一種可能的解決方案是使用AjaxFormComponentUpdatingBehavior
:
val description = new TextField("description", new Model[String])
description.add(new AjaxFormComponentUpdatingBehavior("keyup") {
protected def onUpdate(target: AjaxRequestTarget) {
val newValue = description.getDefaultModelObjectAsString
}
})
我還建議設置Throttling
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.