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



相关文章
|
6月前
MultipartFile转为File
MultipartFile转为File
|
1月前
|
应用服务中间件 Linux
org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nes
org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nes
27 0
|
5月前
|
前端开发 JavaScript
Error_ Multipart_ Boundary not foun
Error_ Multipart_ Boundary not foun
|
10月前
|
SQL
Parameter ‘id‘ not found. Available parameters are [collection, list]
Parameter ‘id‘ not found. Available parameters are [collection, list]
127 0
|
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 报错解决方法
3345 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
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 ……
177 0
Parameter ‘bookID‘ not found. Available parameters are [param1, bookId]
Parameter ‘bookID‘ not found. Available parameters are [param1, bookId]
105 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