2015-03-25 12:25:18 Resolving exception from handler [public org.springframework.web.servlet.ModelAndView com.runda.biz.syscontroller.controller.SysControllerController.save(com.runda.biz.syscontroller.domain.SysController,org.springframework.web.multipart.MultipartHttpServletRequest)]: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'sysController' on field 'nameplate': rejected value [org.springframework.web.multipart.commons.CommonsMultipartFile@a06816]; codes [typeMismatch.sysController.nameplate,typeMismatch.nameplate,typeMismatch.java.lang.String,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [sysController.nameplate,nameplate]; arguments []; default message [nameplate]]; default message [Failed to convert property value of type 'org.springframework.web.multipart.commons.CommonsMultipartFile' to required type 'java.lang.String' for property 'nameplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.web.multipart.commons.CommonsMultipartFile] to required type [java.lang.String] for property 'nameplate': no matching editors or conversion strategy found] 2015-03-25 12:25:18 Resolving exception from handler [public org.springframework.web.servlet.ModelAndView com.runda.biz.syscontroller.controller.SysControllerController.save(com.runda.biz.syscontroller.domain.SysController,org.springframework.web.multipart.MultipartHttpServletRequest)]: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'sysController' on field 'nameplate': rejected value [org.springframework.web.multipart.commons.CommonsMultipartFile@a06816]; codes [typeMismatch.sysController.nameplate,typeMismatch.nameplate,typeMismatch.java.lang.String,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [sysController.nameplate,nameplate]; arguments []; default message [nameplate]]; default message [Failed to convert property value of type 'org.springframework.web.multipart.commons.CommonsMultipartFile' to required type 'java.lang.String' for property 'nameplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.web.multipart.commons.CommonsMultipartFile] to required type [java.lang.String] for property 'nameplate': no matching editors or conversion strategy found] 2015-03-25 12:25:18 Resolving exception from handler [public org.springframework.web.servlet.ModelAndView com.runda.biz.syscontroller.controller.SysControllerController.save(com.runda.biz.syscontroller.domain.SysController,org.springframework.web.multipart.MultipartHttpServletRequest)]: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'sysController' on field 'nameplate': rejected value [org.springframework.web.multipart.commons.CommonsMultipartFile@a06816]; codes [typeMismatch.sysController.nameplate,typeMismatch.nameplate,typeMismatch.java.lang.String,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [sysController.nameplate,nameplate]; arguments []; default message [nameplate]]; default message [Failed to convert property value of type 'org.springframework.web.multipart.commons.CommonsMultipartFile' to required type 'java.lang.String' for property 'nameplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.web.multipart.commons.CommonsMultipartFile] to required type [java.lang.String] for property 'nameplate': no matching editors or conversion strategy found] 2015-03-25 12:25:18 Cleaning up multipart file [nameplate] with original filename [2675057235E34C86B4D53341A718CC42.png], stored at [D:\program files\tomcat6\work\Catalina\localhost\xfjd\upload_6d688c8f_14c4f2d6b2e__8000_00000009.tmp] 2015-03-25 12:25:18 Could not complete request org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'sysController' on field 'nameplate': rejected value [org.springframework.web.multipart.commons.CommonsMultipartFile@a06816]; codes [typeMismatch.sysController.nameplate,typeMismatch.nameplate,typeMismatch.java.lang.String,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [sysController.nameplate,nameplate]; arguments []; default message [nameplate]]; default message [Failed to convert property value of type 'org.springframework.web.multipart.commons.CommonsMultipartFile' to required type 'java.lang.String' for property 'nameplate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.web.multipart.commons.CommonsMultipartFile] to required type [java.lang.String] for property 'nameplate': no matching editors or conversion strategy found] at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:111) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:75) at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:156)
页面上已经有enctype="multipart/form-data".之前没有上传文件这个字段时正常提交的,现在加上这个字段后,程序就不进controller了.请问,可能是什么原因呢?
<!--支持上传文件-->
<beanid="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!--setthemaxuploadsize100MB-->
<propertyname="maxUploadSize">
<value>104857600</value>
</property>
<propertyname="maxInMemorySize">
<value>4096</value>
</property>
</bean>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。