我有一个包含可重复使用面板的页面。该面板包含文件上载逻辑。我已将form.setMaxSize()设置为10MB。是否可以覆盖默认的wicket消息并显示一些自定义消息?
答案 0 :(得分:1)
查看Form.onFileUploadException
:
if (e instanceof SizeLimitExceededException)
{
// Resource key should be <form-id>.uploadTooLarge to
// override default message
final String defaultValue = "Upload must be less than " + getMaxSize();
String msg = getString(getId() + '.' + UPLOAD_TOO_LARGE_RESOURCE_KEY, Model.ofMap(model), defaultValue);
error(msg);
}