I have a form with several <html:text/> input fields and a couple of
<html:file/> input fields. In web.xml, I also specify a value for
maxFileSize (currently set to a really small value of 5K for testing).
Here is the portion of my JSP with the input form:

-----
<html:form
 action="/client/editJob.do"
 method="POST"
 enctype="multipart/form-data"
 focus="jobName">
<html:hidden property="actionClass"/>
<table>
<tr><td>Job Name:</td><td><html:text property="jobName"/></td></tr>
<tr><td>Job Type:</td><td><html:text property="jobType"/></td></tr>
<tr><td>Due Date:</td><td><html:text property="dueDt"/></td></tr>
<tr><td>Thumbnail 1:</td><td><html:file
property="thumbnail1"/></td></tr>
<tr><td>Thumbnail 2:</td><td><html:file
property="thumbnail2"/></td></tr>
<tr><td>Thumbnail 3:</td><td><html:file
property="thumbnail3"/></td></tr>
<tr><td>Thumbnail 4:</td><td><html:file
property="thumbnail4"/></td></tr>
<tr><td>Thumbnail 5:</td><td><html:file
property="thumbnail5"/></td></tr>
</table>
<p><html:submit property="submitProperty" value="Submit"/></p>
</html:form>
-----

My action class uses the actionClass hidden variable to determine when
to display the input form vs. when to process the inputs.

[1] If I enter valid inputs and upload a file smaller than maxFileSize,
everything works fine.

[2] If I enter an invalid input and upload a file smaller than
maxFileSize, the input page gets redisplayed with the form errors at the
top, which is also fine.

[3] If I upload a file larger than maxFileSize, the problem occurs. I
don't get the actionClass form variable set. None of the other form
variables are set either. Thus, the input page redisplays as if the user
just pulled it up. None of what the user typed before is preserved, and
even more importantly, the user gets no indication that it was the size
of the file that caused the input page to redisplay. In fact, the user
gets no mention whatsoever that an error occurred. It just appears to
the user that the application has a bug and is being stubborn.

How do I get the values that the user entered (and also the hidden HTML
fields) when Struts detects a larger than allowed file in a file upload
field? I don't seem to get any indication that Struts decided not to
parse things because the size of a file upload field exceeded the
maxFileSize setting.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to