Required CommonsMultipartFile parameter 'pic' is not present

简介:

org.springframework.web.bind.MissingServletRequestParameterException: Required CommonsMultipartFile parameter 'pic' is not present

在项目中我们优势有时会遇到这种异常,这是因为我们使用了CommonsMultipartFile 对象,但并未接收到这个对象,可以理解为参数名不对,也可以理解为传过来的CommonsMultipartFile对象为null,给该对象设置为不是必须的,即required=false

例:public void getFile(@Request(required=false) CommonsMultipartFile file){}



相关文章
“Could not find suitable distribution for Requirement.parse(‘XXXX‘)”的问题
“Could not find suitable distribution for Requirement.parse(‘XXXX‘)”的问题
406 0
Invalid mapping pattern detected: /download/{{fileName}} ^Not allowed to nest variable c
Invalid mapping pattern detected: /download/{{fileName}} ^Not allowed to nest variable c
|
6月前
|
JavaScript
Component name “header“ should always be multi-word
Component name “header“ should always be multi-word
|
SQL
Parameter ‘id‘ not found. Available parameters are [collection, list]
Parameter ‘id‘ not found. Available parameters are [collection, list]
250 0
|
8月前
|
前端开发 JavaScript
Error_ Multipart_ Boundary not foun
Error_ Multipart_ Boundary not foun
123 0
|
JSON 数据格式
Required request parameter ‘name‘ for method parameter type String is not present 报错解决方法
Required request parameter ‘name‘ for method parameter type String is not present 报错解决方法
3833 0
913 error Component name “home“ should always be multi-word vuemulti-word-component-names
913 error Component name “home“ should always be multi-word vuemulti-word-component-names
125 0
Optional int parameter ‘id‘ is present but cannot be translated into a null value due to being ……
Optional int parameter ‘id‘ is present but cannot be translated into a null value due to being ……
333 0
|
JavaScript 前端开发 开发者
Component name “xxx“ should always be multi-word
Component name “xxx“ should always be multi-word
Component name “xxx“ should always be multi-word