During file upload, we can specify the Interceptor to set the file type, extension name, and size. The configuration in the action is as follows:
500000
Application/vnd. ms-excel
Xls
If the file to be uploaded does not conform to the definition, it will be switched to the input view. Get error information on the page: , Note that the struts label is introduced.
If you need to customize the prompt information, you can set the international configuration information and add the following in the struts. xml file:
Message indicates the property configuration file starting with message. The Chinese file name is message_zh_CN.properties.
You can customize error information in message_zh_CN.properties:
Struts. messages. error. uploading = \ u4E0A \ u4F20 \ u9519 \ u8BEF
Struts. messages. error. file. too. large = \ u6587 \ u4EF6 \ u592A \ u5927
Struts. messages. error. content. type. not. allowed = \ u8BF7 \ u9009 \ u62E9excel \ u6587 \ u4EF6
Struts. messages. error. file. extension. not. allowed = \ u8BF7 \ u9009 \ u62E9.xls \ u7ED3 \ u5C3E \ u7684 \ u6587 \ u4EF6