fileinput+Springboot의 excel 업로드 질문

5036 단어
앞부분은 웹strom으로 쓰고 앞뒤는 분리합니다.
백엔드 코드:
@RequestMapping("upload.action")
public @ResponseBody String Daoru(@RequestParam(value="file",required=false) CommonsMultipartFile[] files, HttpServletResponse resp, HttpServletRequest request){
    //          
    String uploadPath = "E:\\abc";
    resp.setContentType("text/html");
    File baseFile = new File(uploadPath);
    String fileName = "";
    if(!baseFile.exists()){
        baseFile.mkdirs();
    }
    try{
        if(files!=null){
            for(int i=0;ilength;i++){
                if(StringUtil.isblank(files[i].getOriginalFilename())){
                    continue;
                }
                fileName = files[i].getOriginalFilename();
                String filePath =  uploadPath + "/" + fileName;
                files[i].transferTo(new File(filePath));
            }
        }
        resp.flushBuffer();
        //     excel,  sheet    sheet poi   
        String localPath = uploadPath+ "/" + fileName;
        //List sheetName = ExcelUtil.getSheetName(localPath);

        //String list2json = JsonChangeUtil.list2json(sheetName);
       /* return JsonChangeUtil.string2json(this.importExcel(localPath));*/
    }catch(Exception e){
        return null;
    }
    return "true";

}
문제가 발생했습니다:******************************** 필터가 사용되었습니다******************** 2018-07-06 11:44:32821: WARN http-nio-8082-exec-1(DefaultHandlerException Resolver.java:375)-Failed to convert request element: org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException: Failed to convert value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'org.springframework.web.multipart.commons.CommonsMultipartFile[]'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'org.springframework.web.multipart.commons.CommonsMultipartFile': no matching editors or conversion strategy found 2018-07-06 11:44:32,825:WARN http-nio-8082-exec-1 (AbstractHandlerExceptionResolver.java:193) - Resolved exception caused by Handler execution: org.springframework.web.method.annotation.MethodArgumentConversionNotSupportedException: Failed to convert value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'org.springframework.web.multipart.commons.CommonsMultipartFile[]'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile' to required type 'org.springframework.web.multipart.commons.CommonsMultipartFile': no matching editors or conversion strategy found 도메인 간
백엔드 방법이 끊겼어!!!!

좋은 웹페이지 즐겨찾기