开发者

How to override struts.messages.error.file.too.large property

开发者 https://www.devze.com 2023-01-10 15:15 出处:网络
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 wh

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消