springmvc 上传文件的时候.The request sent by the client was syntactically incorrect

 出现这个问题的原因,下面这篇文章已经讲得很清楚的。

http://blog.csdn.net/kunkun378263/article/details/41863101



我遇到的场景是:MultipartFile上传文件,提交表单的时候除了上传文件还有几个数字。我们知道spring servlet在接受前台参数的时候 可以自动进行数据转型。因此在后台接受前台传过来的数字的时候可以使用Integer或者String都可以。但是实际不行,必须使用String接受。


猜测可能的原因是使用下面这个类的原因,参数绑定的时候不能绑定数字类型。

<!-- 文件上传 -->
    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    </bean>

猜你喜欢

转载自blog.csdn.net/xtj332/article/details/44021347