官方提醒413 2023-05-11 17:18 采纳率: 40%
浏览 64

关于#springMVC#的问题,如何解决?

jsp表单中有文件,springMVC不能自动封装成对象

img


加了@RequestPart("file")MultipartFile也还是不行

Field error in object 'student' on field 'bikePicture': rejected value [org.springframework.web.multipart.commons.CommonsMultipartFile@6d233e01]; codes [typeMismatch.student.bikePicture,typeMismatch.bikePicture,typeMismatch.java.lang.String,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [student.bikePicture,bikePicture]; arguments []; default message [bikePicture]]; default message [Failed to convert property value of type 'org.springframework.web.multipart.commons.CommonsMultipartFile' to required type 'java.lang.String' for property 'bikePicture'; 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 'bikePicture': no matching editors or conversion strategy found]]

请问应该怎么解决呢

  • 写回答

2条回答 默认 最新

  • Soulic 2023-05-11 18:12
    关注

    Form表单怎么写的

    评论

报告相同问题?

问题事件

  • 创建了问题 5月11日