Here is a portion of my struts.xml:
<constant name="struts.custom.i18n.resources" value="global" />
and
<action name="picture_save" method="pictureSave" class="PictureActionBean">
<interceptor-ref name="fileUpload">
<param name="maximumSize">
2097152
</param>
<param name="allowedTypes">
image/bmp,image/gif,image/jpeg,image/jpg,image/png
</param>
</interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
<result name="success" type="redirect">picture</result>
<result name="error">error</result>
</action>
My global.properties file is stored directly in src/ and it contains this:
struts.messages.error.uploading=Upload failed
struts.messages.error.file.too.large=Upload file is too large
struts.messages.error.content.type.not.allowed=Wrong file type uploaded
Here is how I'm displaying the error in the jsp:
<s:fielderror />
Currently, when I upload a file that is too big for example, I get the error:
the request was rejected because its size (6561343) exceeds the configured maximum (2097152)
What I want to do is make it say "Uploaded file is too large" instead of the message above. What is an easy way to do this?
EDIT 1:
I'm using struts version 2.1.8.1
EDIT 2:
Another thing is that when I add:
<result name="input" type="redirect">error</result>
to my struts.xml then no error shows at all. What is the reason for this?