本文轉自:http://blog.csdn.net/dqswuyundong/article/details/6427034
在struts2中用common-fileupload上傳文件有文件大小限制,默認 限制爲2M。
如果上傳文件超出限制大小則會報出以下異常:
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (3699829)
exceeds the configured maximum (2097152)
修改上傳文件大小方法:
在struts.xml配置文件中,添加<constant name="struts.multipart.maxSize" value="10485760"/> 這裏的value單位爲B,即10485760B = 10MB。