:::: 개발 ::::/::: JAVA :::

액셀 > html Form > DB

nayha 2015. 11. 24. 14:29
Public ActionForward Reg(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)

System.out.println("mapping============= " + mapping)

FormFile[] formFile = (FormFile[]) htmlForm.getFiles();
//폼에서 파일 파라미터


If (formFile != null && formFile[0] != null) {

POIFSFileSystem filein = new POIFSFileSystem(formFile[0].getInputStream());


HSSFWorkbook wb = new HSSFWorkbook(filein);


HSSFSheet ws = wb.getSheetAt(0);


For (int i = 1; i < 1000; i++) {


Row row = ws.getRow(i);

If( row ==null) continue;



For( int j =0; j < 1; j++) {

If( row.getCell( j) ==null) continue;


try {

//셀 타입 체크


If( row.getCell( j).getCellType() ==Cell.CELL_TYPE_STRING) {
row.getCell( j).getStringCellValue();
}

Else{

String.valueOf((int) row.getCell( j).getNumericCellValue();
}


} catch(Exception e){

}

}// end for j
}// end for i

}












반응형