wicket初學者可以參考一下 這里 的一篇文章。
1.CheckGroup 中 使用Check.而非CheckBox.
2.Form中的組件,納入CompoundPropertyModel,似乎方可得到rawinput。有待確認。
3.Form如果不使用CompoundPropertyModel,注意給控件設置model。
4.dropdownchoice,未選擇情況下提交,即選中了“請選擇”。服務器端得到:
getValue():-1
getInput():
getModelObjectAsString():
5.一個model示例:
int cols=5;
int rows=5;
final String[][] values=new String[rows][cols];
form.add(new Loop("rows", rows) {
populateitem(Item item) {
final int row=item.getindex();
item.add(new Loop("cols", cols) {
populateitem(Item item) {
final int col=item.getindex();
IModel model=new Model() {
setobject(Component c, Object o) {
values[row][col]=o;
}
Object getObject(Component c) {
return values[row][col];
}};
item.add(new TextField("cell", model));
});
<table>
<tr wicket:id="rows"><td wicket:id="cols"><input type="text" wicket:id="cell"/></td></tr>
</table>
1.CheckGroup 中 使用Check.而非CheckBox.
2.Form中的組件,納入CompoundPropertyModel,似乎方可得到rawinput。有待確認。
3.Form如果不使用CompoundPropertyModel,注意給控件設置model。
4.dropdownchoice,未選擇情況下提交,即選中了“請選擇”。服務器端得到:
getValue():-1
getInput():
getModelObjectAsString():
5.一個model示例:
int cols=5;
int rows=5;
final String[][] values=new String[rows][cols];
form.add(new Loop("rows", rows) {
populateitem(Item item) {
final int row=item.getindex();
item.add(new Loop("cols", cols) {
populateitem(Item item) {
final int col=item.getindex();
IModel model=new Model() {
setobject(Component c, Object o) {
values[row][col]=o;
}
Object getObject(Component c) {
return values[row][col];
}};
item.add(new TextField("cell", model));
});
<table>
<tr wicket:id="rows"><td wicket:id="cols"><input type="text" wicket:id="cell"/></td></tr>
</table>