ssh整合web导出excel案例

  • 格式:doc
  • 大小:539.50 KB
  • 文档页数:29

下载文档原格式

  / 29
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

基于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配置

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">

class="mons.dbcp.BasicDataSource">

class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

org.hibernate.dialect.MySQLDialect

true

true

com/luo/ssh/entity/Address.hbm.xml

class="com.luo.ssh.dao.impl.AddressDaoHibernateImpl">

ref="sessionFactory">

class="com.luo.ssh.service.impl.AdressServiceImpl">

ref="addressService">

5.hibernate映射配置(基本)

"/hibernate-mapping-3.0.dtd">

相关主题