I have a form that has an <s:file> element.

When the upload exceeds that size, the input page is returned.  
Log4j records show this log message:
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException:
the request was rejected because its size (xxx) exceeds the configured
maximum (yyy)

All other form elements are blank; required fields show field errors.
The upload element does not show any field errors.
The action never receives the request.
Everything works as expected when the max file size is not exceeded.

Why don't I see the upload field's error?
What happened to all of the other field values?
How can this be fixed?

I'm using struts 2.1.2 w/ xwork 2.1.1
My action uses the default stack.
The application does not have a struts.properties file

I've tried adding a validate( ) method to my action class 
but that did not change things, so I removed it.


===================================================
STRUTS.XML (edited for brevity) ===================
===================================================
<struts>
<include file="struts-default.xml"/>
<constant name="struts.action.extension" value="action" />
<constant name="struts.devMode" value="true" />
<constant name="struts.multipart.maxSize" value="blah" />
<constant name="struts.configuration.xml.reload" value="true" />

<package name="siterequest" 
        namespace="/admin/siterequest" 
        extends="struts-default">
<default-interceptor-ref name="defaultStack"/>
<action name="save" 
        method="save" 
        class="siterequest.SiteRequestAction">
<result>/admin/siterequest/request_form_thanks.jsp</result>
<result name="input">/admin/siterequest/request_form.jsp</result>
</action>
</package>
</struts>

===================================================
JSP PAGE (edited for brevity) =====================
===================================================
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<sx:head/>
<s:head/>
</head>
<body>
<s:form action="save" 
        namespace="/admin/siterequest"
        name="requestform" 
        method="post" 
        enctype="multipart/form-data" 
        theme="xhtml" 
        
tooltipConfig="#{'tooltipIcon':'/../admin/images/icon-help.jpg'}"
        validate="true">
<s:textfield name="siteRequest.projectTitle" 
        label="Project Title" 
        tooltip="A short name for the project"
        maxlength="200" 
        required="true" />
<sx:datetimepicker name="siteRequest.releaseDate" 
        label="Desired Release Date" 
        displayFormat="MM/dd/yyyy" 
        tooltip="blah blah"
        required="true" />
<s:textarea name="siteRequest.description" 
        label="Description" 
        cols="34" 
        rows="5" 
        tooltip="blah blah"
        required="true" />
<s:file name="siteRequest.upload" 
        label="Attachment (maximum: 4 MB)" 
        tooltip="blah blah"
        required="false" />
<s:submit cssStyle="width:80px; align:left; margin-top:20px;"/>
</s:form>
</body>
</html>

===================================================
ACTION CLASS (edited for brevity) =================
===================================================
public class SiteRequestAction extends ActionSupport 
        implements Preparable, SessionAware {
        
public String save() {
        try {
                this.siteRequestFacade.save(this.siteRequest);
                return "success";
        }
        catch (Throwable exception) {
                logger.error("Unable to save SiteRequest: ", exception);
                return "input";
        }
}
Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and
then delete it from your system.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to