How to override struts.messages.error.file.too.large property
I am using Struts2 fileUpload interceptor to upload the files. I have configured the maxSize, allowed contentTypes ... props etc. But when user violate the maxSize ... Struts2 display error message which is very 开发者_JS百科long string ...
I want to change the message string i.e. how I can override struts.messages.error.file.too.large ... any idea?
Thanks!
You can define the custom error messages in your existing message resource .properties file(s) for the class or globally:
struts.messages.error.uploading=Upload error.
struts.messages.error.file.too.large=Uploaded file was too large.
struts.messages.error.content.type.not.allowed=File type is not allowed.
struts.messages.error.file.extension.not.allowed=File extension is not allowed.
If you're not currently using .properties files to store your text, the docs have a good section on using and configuring Message Resource Files.
精彩评论