Meaningless Drivel is fun!*
The moose likes Struts and the fly likes Struts2 file upload resets form if maxsize exceeds Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 file upload resets form if maxsize exceeds" Watch "Struts2 file upload resets form if maxsize exceeds" New topic
Author

Struts2 file upload resets form if maxsize exceeds

Pious Francis
Greenhorn

Joined: Jun 25, 2004
Posts: 11
I am uploading a file using the struts2 file uploder. In struts.xml I set struts.multipart.maxSize to 1 MB. If the file limit exceeds after import, my form data is reset and all user inputs are appearing as blank (I have some text fields along with the file upload control). In the logs I am getting the error 'The request was rejected because its size exceeds the configured maximum' which is expected. I am printing the action errors in JSP and this message is printed in the JSP , which is again as expected.
But why my form data is getting reset?

Another point is if I set maxSize in the fileUpload interceptor it works fine, I am getting errors message with form data kept as it is. The issue is only with the struts2 struts.multipart.maxSize setting in the struts.xml. According to my observation struts.multipart.maxSize takes precedence than the interceptor maxsize setting, so I need to set a upload limit in struts.multipart.maxSize.
And other xml basesd struts validations are working fine for me, where I get validation errors printed on page, but form data is not lost after validation run.

Anybody faced this issue .. Can somebody help to resolve this? Any suggestions appreciated.....
 
Consider Paul's rocket mass heater.
 
subject: Struts2 file upload resets form if maxsize exceeds
 
Similar Threads
Struts2 File Upload Maximum Size
Struts2 & XmlHttpRequest & input_file & Html5
Struts2 & validation [SOLVED]
Struts2: file upload not working
struts2 problem