The source code of FileUploadInterceptor is:
http://svn.apache.org/repos/asf/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java
========================================================
......
if (maximumSize != null && maximumSize < file.length()) {
String errMsg = getTextMessage(action,
"struts.messages.error.file.too.large", new Object[]{inputName,
filename, file.getName(), "" + file.length()}, locale);
......
}
......
========================================================
It dose not pass the maximumSize to the message text as a param.
So I think you have to hard code it in your message text.
But I believe it is simple, and not extra coding need.
2010/12/1 <[email protected]>:
> Before I wrap myself around my own axle, does anyone know a straightforward
> technique for substituting the maximumSize into a message property text
> according to the following scenario.
>
> <action name="singleUpload" class="FileUploadAction"
> method="upload">
> <interceptor-ref name="fileUpload">
> <param name="maximumSize">100123</param>
> <param name="allowedTypes">
> image/png,image/x-png
> </param>
> </interceptor-ref>
> <interceptor-ref name="basicStack" />
> <result name="input">/jsp/SingleUpload.jsp</result>
> <result>/jsp/Confirm.jsp</result>
> </action>
>
> struts.messages.error.file.too.large=File {1} is {3} bytes which exceeds the
> maximum DDDDDD
>
> I see the value 100123 in the FileUploadInterceptor inside the
> ActionInvocation, but before I write stupid code, I'd like to see if there
> might be a straightforward approach.
>
> Peace,
> Scott
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]