加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 如何避免在wicket中请求结束时重置FileUploadField

发布时间:2020-12-15 03:04:00 所属栏目:Java 来源:网络整理
导读:我有一个包含FileUploadField和更多文本字段的wicket表单.缺少必填字段时,验证正确失败.然后,我为上传选择的文件变空,所以在提交填写了所有必填字段的表单之前,我必须再次选择它. 事实上,FileUploadField documentation说: The model of this component is
我有一个包含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.

表单验证失败时,有没有办法保留选定的文件?

解决方法

不会.问题是浏览器刷新它,并且出于(浏览器)安全原因,您无法在文件字段上设置默认值.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读