最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Struts2 the request was rejected because its size (xxx) exceeds the configured maximum (xxx)异常解决方案

旗下网站admin41浏览0评论

Struts2 the request was rejected because its size (xxx) exceeds the configured maximum (xxx)异常解决方案

Struts2 the request was rejected because its size (xxx) exceeds the configured maximum (xxx)异常解决方案

最近遇到一个问题,就是Struts2上传文件过程中,上传的文件过大,超过了默认的文件大小,就会抛出上面这个异常。

不多BB,直接上解决方法:

在struts.xml配置文件里加入这一行代码,修改默认大小(默认为2M)

<!-- 图片上传最大限制,单位byte -->
<constant name="struts.multipart.maxSize" value="10000000"></constant>

上传のjsp代码:

<body>
    <form action="upload" method="post" enctype="multipart/form-data">
    	upload file:<input type="file" name="some" /><br/>
    	<input type="submit" value="upload" /><br/>
    </form>
  </body>

​​​​​​​

发布评论

评论列表(0)

  1. 暂无评论