I am using struts and have an upload.jsp and its associated UploadForm.java and UploadAction.java. The jsp's form has an enctype=multipart/form-data and contains an html:file field to upload a file as well as a bunch of text fields for metadata associated with the file. If an error occurs during validation, the struts controller servlet forwards to the same jsp with error messages. The problem is that the filepath the user specified is no longer present. Is there a way to restore this value so the user doesn't have to complete this field again (the other text fields remain filled in).
Originally posted by Rajeev Ja: Is there a way to restore this value so the user doesn't have to complete this field again?
No, there isn't.
Instead of validation If i have other button on click of that it will go the action class and all other field values are restored except the browse button file path how to resolve this
posted 12 years ago
The fact is that once a form is submitted, there is no way to redisplay the <html:file> field with its original contents because of the security issue that I mentioned in my last post. Whatever solution you devise must take into account this fact.
One possible solution would be to make an AJAX call to the server without submitting the form.