1

我有一个包含可重用面板的页面。此面板包含文件上传逻辑。我已将 form.setMaxSize() 设置为 10MB。是否可以覆盖默认的检票口消息并显示一些自定义消息?

4

1 回答 1

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);
}
于 2012-02-08T10:25:54.713 回答