日期:2014-05-20  浏览次数:20724 次

求高手给写个JSP读取excel表的内容代码
我想用java,在JSP页面弄个浏览按钮,选择文件然后把选择到的文件上传到自己的服务器,tomcat上面,然后根据读取上传的excel文件的内容!求高手!!!!还有个问题,做这个功能所需的JAR包,为什么我有了JXL.JAR包在后台java页面还是导入不了
,比如:import jxl.*;
  import jxl.write.*;
JXL是红色的,我的包也放到了项目的lib目录中!高手们有做的话,给我附带个包,谢谢了!!!!!

------解决方案--------------------
你的包放到了lib目录里面是没用的,要将lib目录的jar加入到classpath当中,加入方法工程名右键-build path-configurate ...-classpath -libraries -add jars ,你自己搜一下加入classpath方法也行
这样import就正常了
------解决方案--------------------
用poi吧,读取的效率poi比 jxl高,简单的demo:http://blog.csdn.net/shuwei003/article/details/6741649
jar包下载地址:
http://poi.apache.org/download.html
------解决方案--------------------
探讨

你的包放到了lib目录里面是没用的,要将lib目录的jar加入到classpath当中,加入方法工程名右键-build path-configurate ...-classpath -libraries -add jars ,你自己搜一下加入classpath方法也行
这样import就正常了

------解决方案--------------------
@SuppressWarnings({ "unchecked", "rawtypes" })
 public Map getMap() throws BiffException, IOException, DocumentException{
// HashMap mapGroup = new HashMap();
getDts();
HashMap mapPerson = new HashMap();
File file1 = new File("resource/zu.xls");// 读取组的xls文件
InputStream is1 = new FileInputStream(file1);
jxl.Workbook rwb1 = Workbook.getWorkbook(is1);
Sheet st1 = rwb1.getSheet(0);// 得到excel中的第1张表
for (int i = 1; i < st1.getRows(); i++) {// 判断有哪些组添加到hashmap中
Cell cgroup = st1.getCell(1, i);
String group = cgroup.getContents();
Cell cperson = st1.getCell(0, i);
String person = cperson.getContents();
// mapGroup.put(group, person);
mapPerson.put(person, group);
}
return mapPerson;
 }

------解决方案--------------------
http://topic.csdn.net/u/20110830/11/b96a4b05-d775-494b-bb68-fb41e540ac9d.html
哥们自己写的,你参考下吧。
------解决方案--------------------
http://blog.csdn.net/tkd03072010/article/details/6692366
前些日子刚整理的 用jxl实现jsp读取Excel数据