1. 가져 오기
프론트 페이지와 점프 JS
< T : dgToolBar의 표제 = "단일 템플릿 가져 오기" 아이콘 = "아이콘-PUT" funname = "Importonlyone" > </ T : dgToolBar >
기능 Importonlyone (제목, URL, gname는) { gridname = gname는; VAR의 IDS = []; var에 행 = $ ( "#"+ gname는은 () 'getSelections를'.datagrid ); 경우 (rows.length == 1 ) { openuploadwin ( '엑셀 가져 오기', 'decMainController.do?upload&num=1&ids='+rows[0].id, "decMainList" ); } }
< t : formvalid formid = "formobj" 레이아웃 = "DIV" 대화 = "true"를 beforeSubmit = "업로드" > < FIELDSET 클래스 = "단계" > < DIV 클래스 = "형식" > < t : 업로드 이름 = "fiels" - 버튼 = "选择要导入的文件" 업 로더 = "$ {controller_name} 수도 있었죠 $ {빈 METHOD_NAME 'importExcel': METHOD_NAME이}?" 확장 ".. * XLS * XLSX"= ID = "file_upload" formData = " 문서 제목"> </ t : 업로드 > </ DIV > <DIV 클래스 = "형태" ID = "filediv" 스타일 = "높이 : 50 픽셀" > </ DIV > </ FIELDSET > </ t : formvalid >
가져 오기 및 분석 배경 점프 방법
(PARAMS = "업"@RequestMapping ) 공공 의 ModelAndView 업로드 (HttpServletRequest의 REQ) { req.setAttribute ( "controller_name를", "decMainController" ); req.setAttribute ( "METHOD_NAME", "importonlyone" ); req.setAttribute ( "IDS", req.getParameter ( "IDS" )); 반환 새로운 ModelAndView 활성화 ( "COM / jeecg / decmain / pub_excel_upload" ); }
@SuppressWarnings ( "선택 해제" ) @RequestMapping (PARAMS = "importonlyone를"METHOD = RequestMethod.POST) @ResponseBody 공개 AjaxJson의 importonlyone (HttpServletRequest의 요청 HttpServletResponse를 대응) 발생 예외 { AjaxJson j를 = 새로운 AjaxJson을 (); MultipartHttpServletRequest를 multipartRequest = (MultipartHttpServletRequest를) 요청; 목록은 <의 MultipartFile는> contactFile는 = 새로운 <의 MultipartFile>의 ArrayList를 (); 지도 <문자열,의 MultipartFile> fileMap = multipartRequest.getFileMap (); 대한 (의 Map.Entry <문자열,의 MultipartFile> {: fileMap.entrySet () 엔티티) 의 MultipartFile 파일 = entity.getValue을 (); // 업로드 파일 개체를 가져옵니다 contactFile.add (파일); } XSSFWorkbook의 WB; // 2007 년 이전 HSSFWorkbook입니다 // 페이지 XSSFSheet 시트; // 완성 된 형태 // 행 XSSFRow 행; // 완성 된 형태의 행 // 열려있는 파일 은 try { WB = 새로운 XSSFWorkbook (contactFile.get (0 ) .getInputStream ()); } 캐치 (IOException이 전자) { e.printStackTrace (); WB는 = 새로운 XSSFWorkbook을 (); } 시트 wb.getSheetAt (= 0 ); INT ROWNUM = sheet.getLastRowNum (); DecMainPage decMainPage는 = 새로운 DecMainPage을 (); 행 sheet.getRow (= 1 ); Ieflag 문자열 = getCellFormatValue (row.getCell (1).); // 수입 식별자
}