1. 程式人生 > >springmvc 上傳檔案的時候.The request sent by the client was syntactically incorrect

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>