gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:26:19 25 4
gpt4 key购买 nike

我有一个 wicket 表单,其中包含一个 FileUploadField 和一些更多的文本字段。当缺少必填字段时,验证将正确失败。然后,我选择上传的文件变成空的,所以我必须再次选择它,然后才能提交填写了所有必填字段的表单。

事实上,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.

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

最佳答案

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

关于java - 如何避免在 wicket 请求结束时重置 FileUploadField,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6598646/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com