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){}



相关文章
|
4天前
|
JavaScript API
required string parameter ‘XXX‘is not present 的几种情况
required string parameter ‘XXX‘is not present 的几种情况
84 0
|
6月前
MultipartFile转为File
MultipartFile转为File
|
4天前
|
前端开发 JavaScript
Error_ Multipart_ Boundary not foun
Error_ Multipart_ Boundary not foun
|
9月前
|
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 报错解决方法
3376 0
|
9月前
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
50 0
|
11月前
|
SQL
错误代码: 1364 Field ‘password‘ doesn‘t have a default value
错误代码: 1364 Field ‘password‘ doesn‘t have a default value
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 ……
187 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
Useful code snippet to parse the key value pairs in URL
Useful code snippet to parse the key value pairs in URL
Useful code snippet to parse the key value pairs in URL
Posted content type isn't multipart/form-data
Posted content type isn't multipart/form-data
441 0