【发布时间】:2011-07-19 13:40:56
【问题描述】:
如果我隐藏和禁用 Wicket 表单,我是否需要在我的 onSubmit 中仔细检查可见性条件? (就像我们在 JS 验证与服务器验证中所做的一样?)
考虑一下这个 Wicket sn-p:
public class TestPage extends WebPage {
public TestPage() {
boolean editable = checkIfUserCanEdit();
add(new TestForm()
.setEditable(false)
.setVisible(false));
}
}
public static class TestForm {
...
public void onSubmit() {
if (!checkIfUserCanEdit()) abort(); // Is this necessary?
...
}
}
我的 onSubmit 是否需要“重新验证”?
【问题讨论】: