文件上傳錯誤信息:Expected MultipartHttpServletRequest: is a MultipartResolver configured?


springMVC使用multipartFile上傳文件出錯:Expected MultipartHttpServletRequest: is a MultipartResolver configured?

該錯誤信息是由於springmvc配置信息的id必須為multipartResolver

修改之前代碼:

 

1 <!--注冊文件上傳解析器-->
2     <bean id="commonsMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
3         <property name="defaultEncoding" value="UTF-8"></property>
4     </bean>

 

 

修改之后代碼:

 

 

1 <!--注冊文件上傳解析器-->
2     <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
3         <property name="defaultEncoding" value="UTF-8"></property>
4     </bean>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM