Wicket学习随笔

本文介绍了Wicket框架中ListView控件的setReuseItems方法的作用及其在表单中的使用建议,同时探讨了Button组件的defaultFormProcessing属性及onSubmit方法的调用顺序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 数据列表控件ListView

Wicket doc中关于ListView有如下表述:

http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/list/ListView.html#setReuseItems(boolean)

setReuseItems

public ListView<T> setReuseItems(boolean reuseItems)
If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems. If you nest a ListView in a Form, ALLWAYS set this property to true, as otherwise validation will not work properly.
所以在from中使用ListView,想更好的re-rendering的话,调用 setReuseItems(true)!

 2 Button

是调用Button的onSubmit method还是调用Form的onSubmit method,调用顺序如何?请看下面

http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/Button.html

One other option you should know of is the 'defaultFormProcessing' property of Button components. When you set this to false (default is true), all validation and formupdating is bypassed and the onSubmit method of that button is called directly, and the onSubmit method of the parent form is not called. A common use for this is to create a cancel button.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值