怎么读取本地的一个Excel表格的数据存入数据库中-怎么读取本地的一个Excel表格的数据存入数据库中-怎么读取本地的一个Excel表格的数据存入数据库中
解决方案 »
- SAXReader 路径解析问题
- 关于myeclipse 8.5 不能使用JAVAEE 1.6如何解决。。
- 如何实现类似评论的效果?
- 菜鸟一名,想知道域名是怎样解析的?
- RMI的简单问题
- (高手看过来)为什么这个替换不能实现?replace的BUG吗?
- 用EJB开发对多个table的维护,请问是用一个session好,还是多个?
- 制作《j2ee实现进出口贸易mis》!能帮忙的帮个忙,毕业设计担忧中!
- 这是j2ee没装好吗?
- 一个关于CMP插入数据库的速度问题
- struts2启动出现startup failed due to previous errors异常!求教!
- 100分求思路 班级、课程、教师的映射问题(Hibernate)
public String importEdittrainersultDetail() throws FileNotFoundException,
IOException {
String trainClassId = getRequest().getParameter("trainClassId");
educationTrainClass = tEducationTrainClassService
.fetchTEducationTrainClassByTrainClassId(trainClassId);
HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(
getUploadFile()[0]));
HSSFSheet sheet = workbook.getSheetAt(0);
int rowNum = sheet.getLastRowNum();
for (int j = 3; j <= rowNum; j++) {
HSSFRow row = sheet.getRow(j);
if (row == null) {
continue;
}
HSSFCell cell1 = row.getCell((short) 0);
HSSFCell cell2 = row.getCell((short) 1);
HSSFCell cell3 = row.getCell((short) 2);
HSSFCell cell4 = row.getCell((short) 3);
HSSFCell cell5 = row.getCell((short) 4);
HSSFCell cell6 = row.getCell((short) 5);
HSSFCell cell7 = row.getCell((short) 6);
HSSFCell cell8 = row.getCell((short) 7);
HSSFCell cell9 = row.getCell((short) 8);
HSSFCell cell10 = row.getCell((short) 9); TPoliceStudent tPoliceStudent = new TPoliceStudent();
tPoliceStudent.setTEducationTrainClass(educationTrainClass);
tPoliceStudent.setName(cell1.getRichStringCellValue().getString());
tPoliceStudent.setPoliceNumber(cell2.getRichStringCellValue()
.getString());
tPoliceStudent.setSex(cell3.getRichStringCellValue().getString());
tPoliceStudent.setDeptKsd(cell4.getRichStringCellValue()
.getString());
tPoliceStudent.setDuty(cell5.getRichStringCellValue().getString());
tPoliceStudent.setPoliceType(cell6.getRichStringCellValue()
.getString());
tPoliceStudent.setPersonalEvaluation(cell7.getRichStringCellValue()
.getString());
tPoliceStudent.setPromoteInsignias(cell8.getRichStringCellValue()
.getString());
tPoliceStudent.setPromoteType(cell9.getRichStringCellValue()
.getString());
tPoliceStudent.setBirthday(DateUtils.parseDate(cell10
.getRichStringCellValue().getString()));
tPoliceStudentService.insertTPoliceStudent(tPoliceStudent);
}
return SUCCESS;
}
整个发上来自已改改吧