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>
