我有一个包含FileUploadField和更多文本字段的wicket表单.缺少必填字段时,验证正确失败.然后,我为上传选择的文件变空,所以在提交填写了所有必填字段的表单之前,我必须再次选择它.
事实上,FileUploadField documentation说:
The model of this component is reset with null at the end of the request because FileUpload instances do not survive across requests since the input streams they point to will be closed. Because of this,the FileUpload instance should be processed within the same request as the form containing it was submitted.
表单验证失败时,有没有办法保留选定的文件?
解决方法
不会.问题是浏览器刷新它,并且出于(浏览器)安全原因,您无法在文件字段上设置默认值.