我试图获取 Wicket-Component 的路径,但在调用 componentName.getPath()
时它始终只返回 id。
实际上getPath()
的返回值与getId()
相同。
可能是什么问题以及如何获取路径?
我的目标是当另一个组合框字段中的条目发生更改时更新标签字段,以便它采用新值。两个字段位于同一页面但位于不同的面板上。我试图获取该标签元素的路径,但不幸的是我总是遇到此异常:
最后一个原因:行为 redb.main.modules.sample.view.details.pck.PackageCharacterizationPanel$9 只能添加到 FormComponent
我这样做了:
add(new ComboBoxField<String>("name", fieldLabel("name")) {
private static final long serialVersionUID = 1L;
@Override
public IModel<List<String>> provideChoices() {
return packageNameChoices;
}
}.add(new AjaxFormComponentUpdatingBehavior("onkeyup") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(getPage().get("sample_details.logistic.package.label"));
}
}));`
最佳答案
ComboBoxField
不得延长检门的 org.apache.wicket.markup.html.form.FormComponent<T>
这就是您遇到异常的原因。
关于java - Wicket getPath 仅返回 id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28585187/