文档详情

ssh整合web导出excel案例.doc

发布:2019-03-26约2.31万字共29页下载文档
文本预览下载声明
基于Spring,Struts2,Hibernate整合, jsp页面导出(下载)excel文件的简单应用 1)本例不采用Java任何导出excel文件常用的poi或者jxl等第三方jar包,仅仅基于I/O,做一个最简单的ssh整合excel文件导出(下载)。 2)2-3为功能展示 a.主页展示 ·导出当前页到excel文件 ·导出全部到excel文件 b.详细信息展示(下属子地名) ·导出当前页到excel文件 3)4-7为ssh整合相关xml配置 a. Spring相关xml配置 b. Hibernate相关xml配置 c. Struts2相关xml配置 d. web.xml配置(Spring容器的实例化,struts过滤器的配置) 3)8-14为源代码 a.action代码 b.service代码(导出excel文件具体实现,包括下载文件名中文乱码问题,详见代码注释) c.dao代码 4)15-17为jsp页面 a.index.jsp(主页) b.list.jsp(列表显示) c.detail.jsp(详细信息-子地址列表显示) 1.导入相关jar包(ssh+dbcp) 2.本例导出全国地址详细信息,数据库中数据内容如下: 3.功能展示 a.主页 b.导出当前页(文件名为当前页起始id到结束id) c.导出当前页的excel文件内容 d.导出全部 e.下属地名详细信息 f.导出下属地名 4.spring配置 ?xml version=1.0 encoding=UTF-8? beans xmlns=/schema/beans xmlns:xsi=/2001/XMLSchema-instance xmlns:p=/schema/p xmlns:aop=/schema/aop xmlns:context=/schema/context xmlns:jee=/schema/jee xmlns:tx=/schema/tx xsi:schemaLocation=/schema/aop /schema/aop/spring-aop-2.5.xsd /schema/beans /schema/beans/spring-beans-2.5.xsd /schema/context /schema/context/spring-context-2.5.xsd /schema/jee /schema/jee/spring-jee-2.5.xsd /schema/tx /schema/tx/spring-tx-2.5.xsd bean id=dataSource class=mons.dbcp.BasicDataSource property name=url value=jdbc:mysql://localhost:3306/photo /property property name=username value=root /property property name=password value=hl1437 /property property name=driverClassName value=com.mysql.jdbc.Driver /property /bean bean id=sessionFactory class=org.springframework.orm.hibernate3.LocalSessionFactoryBean property name=dataSource ref=dataSource /property property name=hibernateProperties props prop key=hibernate.dialect org.hibernate.dialect.MySQLDialect /prop prop key=hibernate.show_sqltrue/prop prop key=hibernate.format_sqltrue/prop /props /property property name=mappingResources list valuecom/luo/ssh/entity/Address.hbm.xml/value /list /property /bean bean
显示全部
相似文档