2012년 2월 21일 화요일

Failed to convert property value of type org.springframework.web.multipart.commons.CommonsMultipartFile to required type java.lang.String for property attach

Spring Error Messages : Failed to convert property value of type org.springframework.web.multipart.commons.CommonsMultipartFile to required type java.lang.String for property attach;
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 attach: no matching editors or conversion strategy found;

 Spring FileUpload Method convert property value of type missmatch

Domain.java

public class Domain {
     String name; 
     String file;    // => to  CommonsMultipartFile file;

    ..  getter  and setter ..
}

Controller.java
public class uploadController {

               public String uploadHandle(@RequestParam ("file") MultipartFile file ){
                       // more method Control;
               }
}

upload.jsp

<form  method="post" action="upload.do" commandName="domain" 
                                 enctype="multipart/form-data >
<input  type="text" id="name" name="name" />
<input  type="file" id="file" name="file" />
<input type="sumit" value="transfer"  />
</form>
 



 

댓글 없음:

댓글 쓰기