开发者

How to avoid FileUploadField reset at the end of the request in wicket

I have a wicket form containing a FileUploadField and some more text fields. When a mandatory field is missing, the validation correctly fails. Then, the file I chose for the upload becomes empty, so I have to select it one more time before submitting the form with all required fields filled out.

In fact, the FileUploadField documentation says:

The model of this component is reset with null at the end of the reque开发者_C百科st 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.

Is there a way to keep the selected file when the form validation fails?


No. The problem is that the browser refreshes it, and for (browser) security reasons, you cannot set the default value on file fields.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜