解析:这个最大值是在struts2的源文件“struts2-core-2.0.11.1.jar\org\apache\struts\ default.properties”中的struts.multipart.maxSize=2097152语句,如果想改大的话,就重新设定它,有两种方法:
一种是重写:struts.properties文件。
二是在struts.xml中加入常量来改变它如“ Java代码
<constant name="struts.multipart.maxSize" value="10000000" />
当然了,也有struts2的拦截器可以限制文件的类型、大小等,但是当上传文件大小2M后,这个拦截器就不起作用了,只用小于2M(默认大小)的时候才起作用。那是因为:common-fileupload组件默认最大支持上传文件的大小为2M,当我们上传大于2M的文件时,就会出现上面所说的异常。是这个异常的发生导致了fileUpload拦截器没有机会执行,所以看到的是页面没有任何变化,也没有任何提示信息,只是在控制台打印出了上面的那些上传文件过大的异常。
我解决问题的过程:
刚开始只是在struts.xml文件最上部加入
<constant name="struts.multipart.maxSize" value="1000000000" />
pt">但还是报同样的错误。
接着查看struts.properties文件里的配置为:
### Load custom default resource bundles
struts.custom.i18n.resources=MessageResource
struts.multipart.maxSize=50097152
### character encoding
struts.i18n.encoding=GBK
修改为
### Load custom default resource bundles
struts.custom.i18n.resources=MessageResource
struts.multipart.maxSize=1000000000
### character encoding
struts.i18n.encoding=GBK
分享到:
相关推荐
Git-2.37.1,windows64位用。好用的版本。
the request was rejected because its size (16272982) exceeds the configured maximum (9000000) 2.fileUpload拦截器的maximumSize属性必须小于struts.multipart.maxSize的值。 struts.multipart.maxSize默认2M...
org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException:the request was rejected because its size (66704562) exceeds the configured maximum (52428800) ``` 此问题的发生是由于...
InvalidRequest-The request is invalid(解决方案).md
在使用IntelliJ IDEA(简称Idea)上传代码到GitHub时,可能会遇到“Push rejected: Push to origin/master was rejected”的错误。这个问题通常发生在你尝试将一个新的项目推送到一个已存在文件的GitHub仓库时。以下...
if (anErrorMessage.startsWith("the request was rejected because its size")) { Matcher m = Pattern.compile("\\d+").matcher(anErrorMessage); String s1 = ""; if (m.find()) { s1 = m.group(); } ...
The total number of committers at that time was 269. Committers fall into three groups: committers who are only concerned with one area of the project (for instance file systems), committers who are...
The training was fantastic, and all the concepts that were swirling around in their minds prior to the trip suddenly became very real. However, they were the only two ...
version of Delphi and C++ Builder has its own package; DragDropD6.dpk for Delphi 6, DragDropD5.dpk for Delphi 5, DragDropC5.bpk for C++ Builder 5, etc. 4) Add the Drag and Drop Component Suite ...
1、依赖工具去官网下载node2、安装和构建如果报The operation was rejected by your operating system.使用安
The Server is not licensed for this operation.Connection rejected, the server license allows connections from only 5 unique IP addresses. 没有授权 提示5个IP访问的限制 解决办法: 从licensecodes.oracle...
4. A) The woman rejected the man's apology. B) The woman appreciated the man's offer. C) The man had forgotten the whole thing. D) The man had hurt the woman's feelings. 5. A) The woman is ...
This process involves several stages, including lexical analysis, where the source code is tokenized, and any unrecognized words or syntax errors are rejected. The tokens are then passed to the ...
3. "He is very likely to be rejected because of his bad eyesight." 这句话展示了条件句的表达,"be likely to do"(可能做某事)和原因状语。 4. "The committee members have conflicting opinions as to the ...
DLL: JTAG: When only having 1 TAP in the JTAG chain and its matches the one for the configured CPU core but the TAP-ID was unknown, connect did not work. Fixed. DLL: Linux: Delayed / slowed execution ...
Q: Error while loading Word document: “Call was rejected by callee”, “Command failed”, “The RPC server is unavailable”, etc. A: Connection to Microsoft Word may be blocked by the anti-virus ...
SpringBoot 提示:RequestRejectedExceptionnThe request was rejected because the URL was not normalized. 在使用 SpringBoot 时,可能会出现 URL normalization 错误。解决方法是,检查应用程序的 URL 配置,...
3. "It is very likely that he will be rejected by the army because of his bad eyesight." "It is likely that..."的句型用于表达可能性,"because of"引导原因。 4. "The mittee members have conflicting ...