ssh整合web导出excel案例
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 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配置
<?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_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/luo/ssh/entity/Address.hbm.xml</value>
</list>
</property>
</bean>
<bean id="addressDao"
class="com.luo.ssh.dao.impl.AddressDaoHibernateImpl">
<property name="sessionFactory"
ref="sessionFactory"></property>
</bean>
<bean id="addressService"
class="com.luo.ssh.service.impl.AdressServiceImpl">
<property name="addressDao"ref="addressDao"></property> </bean>
<bean id="addressAction"class="com.luo.ssh.action.AddressAction"> <property name="addressService"
ref="addressService"></property>
</bean>
</beans>
5.hibernate映射配置(基本)
<?xml version="1.0"encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.luo.ssh.entity.Address"table="address"
catalog="photo">
<id name="id"type="integer">
<column name="id"/>
<generator class="native"></generator>
</id>
<property name="name"type="string">
<column name="name"length="50"/>
</property>
<property name="level"type="integer">
<column name="level"/>
</property>
<property name="upid"type="integer">
<column name="upid"/>
</property>
<property name="info"type="string">
<column name="info"/>
</property>
</class>
</hibernate-mapping>
6.struts配置
<?xml version="1.0"encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"/dtds/struts-2.1.7.dtd">
<struts>
<package name="ssh"extends="struts-default">
<action name="list"class="addressAction"method="list"> <param name="pageSize">36</param>
<result>/list.jsp</result>
</action>
<action name="detail"class="addressAction"method="detail"> <result>/detail.jsp</result>
</action>
<action name="pageToExcel"class="addressAction"
method="pageToExcel">
</action>
<action name="allToExcel"class="addressAction"
method="allToExcel">
</action>
<action name="childrenToExcel"class="addressAction"
method="childrenToExcel">
</action>
</package>
</struts>
7.web.xml配置
<?xml version="1.0"encoding="UTF-8"?>
<web-app version="2.5"
xmlns="/xml/ns/javaee"
xmlns:xsi="/2001/XMLSchema-instance"
xsi:schemaLocation="/xml/ns/javaee
/xml/ns/javaee/web-app_2_5.xsd">
<!-- 指明spring容器位置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:ssh.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFi lter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
8.实体类Address
package com.luo.ssh.entity;
import java.io.Serializable;
/**
* 地名类
* @author罗立明
*
*/
public class Address implements Serializable { /**地名的id,唯一*/
private int id;
/**地名*/
private String name;
/**地名的下属级别,直辖市,省,自治区为1,其他没下一级级别+1*/ private int level;
/**地名上一级的id,直辖市,省,自治区的上级id为0*/
private int upid;
/**保留字段,地名备注及描述*/
private String info;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
= name;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getUpid() {
return upid;
}
public void setUpid(int upid) {
this.upid = upid;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
= info;
}
@Override
public int hashCode() {
return id<<16;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Address other = (Address) obj;
if (id != other.id)
return false;
return true;
}
@Override
public String toString() {
return"id:"+id+"\n地名:"+name+"\n级别:"+level+"\n上一级id:"+upid;
}
}
9.dao接口定义
package com.luo.ssh.dao;
import java.util.List;
import com.luo.ssh.entity.Address;
public interface AddressDao {
/**
* 查询地址总数
* @return
*/
public int count();
/**
* 根据id查找地址
* @param id
* @return
*/
public Address findById(int id);
/**
* 根据id查找所有下级地址
* @param address
* @return
*/
public List<Address> findChildren(Address address);
/**
* 根据id查找该地址的详细信息,追溯到最高上级
* @param id
* @return 结果形如:湖北省-荆州市-公安县-狮子口镇
*/
public String findDetailById(int id);
/**
* 根据地名模糊查询所有满足条件的地址
* @param name
* @return
*/
public List<Address> findLikeName(String name);
/**
* 分页查询地址信息
* @param page
* @param pageSize
* @return
*/
public List<Address> findPage(int page,int pageSize);
/**
* 查询全部
* @return
*/
public List<Address> findAll();
}
10.dao的Hibernate实现
package com.luo.ssh.dao.impl;
import java.sql.SQLException;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.HibernateTemplate; import
org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.luo.ssh.dao.AddressDao;
import com.luo.ssh.entity.Address;
public class AddressDaoHibernateImpl extends HibernateDaoSupport implements AddressDao {
public Address findById(int id) {
HibernateTemplate template=getHibernateTemplate();
Address address=(Address)template.get(Address.class, id);
return address;
}
public List<Address> findChildren(Address address) { String hql="from Address where upid=?";
return getHibernateTemplate().find(hql, address.getId());
}
public String findDetailById(int id) {
Address add=findById(id);
String detail=add.getName();
while(add.getLevel()!=1){
add=findById(add.getUpid());
detail=add.getName()+"-"+detail;
}
return detail;
}
public List<Address> findLikeName(String name) {
String hql="from Address where name like ?";
return getHibernateTemplate().find(hql, "%"+name+"%");
}
public int count() {
String hql="select count(*) from Address";
return
Integer.parseInt(getHibernateTemplate().find(hql).get(0).toString());
}
public List<Address> findPage(final int page, final int pageSize) { HibernateTemplate template=getHibernateTemplate();
HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
String hql="from Address";
Query query=session.createQuery(hql);
query.setFirstResult((page-1)*pageSize);
query.setMaxResults(pageSize);
return query.list();
}
});
return list;
}
public List<Address> findAll() {
String hql="from Address";
return getHibernateTemplate().find(hql);
}
}
11.service接口定义
package com.luo.ssh.service;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.luo.ssh.entity.Address;
public interface AddressService {
/**
* 分页查找
* @param page
* @param pageSize
* @return
*/
List<Address> findPage(int page, int pageSize);
/**
* 统计总数
* @return
*/
int count();
/**
* 根据ID查找地址
* @param id
* @return
*/
Address findById(int id);
/**
* 查找当前地址的下属地址
* @param address
* @return
*/
List<Address> findChildred(Address address);
/**
* 导出当前页到excel文件
* @param page
* @param pageSize
* @param response
*/
void pageToExcel(int page, int pageSize,HttpServletResponse response);
/**
* 导出数据库全部信息到excel文件
* @param response
*/
void allToExcel(HttpServletResponse response);
/**
* 导出指定id的地址子地址到excel文件
* @param id
* @param response
*/
void childrenToExcel(int id, HttpServletResponse response);
/**
* 导出功能实现
* @param list 要导出的数据
* @param fileName 下载显示的文件名
* @param response
*/
void toExcel(List<Address> list,String fileName, HttpServletResponse response);
/**
* 根据id查找完整地址
* @param id
* @return
*/
String findDetailById(int id);
}
12.service实现
package com.luo.ssh.service.impl;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.luo.ssh.dao.AddressDao;
import com.luo.ssh.entity.Address;
import com.luo.ssh.service.AddressService;
public class AdressServiceImpl implements AddressService { private AddressDao addressDao;
public void setAddressDao(AddressDao addressDao) {
this.addressDao = addressDao;
}
public AddressDao getAddressDao() {
return addressDao;
}
public List<Address> findPage(int page, int pageSize) {
//page和pageSize的简单验证
int total=count();
if(page<=0){
page=1;
}
if(pageSize<10){
page=10;
}
if(pageSize>100){
page=100;
}
int maxPage=total%pageSize==0?total/pageSize:total/pageSize+1;
if(page>maxPage){
page=maxPage;
}
return addressDao.findPage(page, pageSize);
}
public int count() {
return addressDao.count();
}
public Address findById(int id) {
return addressDao.findById(id);
}
public List<Address> findChildred(Address address) {
return addressDao.findChildren(address);
}
//导出当前页到excel文件
public void pageToExcel(int page, int pageSize, HttpServletResponse response) {
//需要导出的数据
List<Address> list=findPage(page,pageSize);
//下载是显示给用户的文件名(如果是中文需要作一定处理,否则会有乱码)
String fileName=(page-1)*pageSize+1+"-"+page*pageSize+".xls";
//调用导出的具体实现方法
toExcel(list,fileName,response);
}
//导出数据库全部信息到excel文件
public void allToExcel(HttpServletResponse response) {
//需要导出的数据
List<Address> list=addressDao.findAll();
//下载是显示给用户的文件名(如果是中文需要作一定处理,否则会有乱码)
String fileName="all.xls";
//调用导出的具体实现方法
toExcel(list,fileName,response);
}
public void childrenToExcel(int id, HttpServletResponse response) { Address parent=new Address();
parent.setId(id);
List<Address> list=addressDao.findChildren(parent);
//下载是显示给用户的文件名(如果是中文需要作一定处理,否则会有乱码)
String fileName=addressDao.findDetailById(id)+"_下属地址.xls";
//调用导出的具体实现方法
toExcel(list,fileName,response);
}
//导出的具体实现方法
public void toExcel(List<Address> list, String fileName, HttpServletResponse response) {
try {
//对文件名作处理,避免中文乱码问题
String name = new
String(fileName.getBytes("gbk"),"iso8859-1");
//设置response相应属性,设置为下载
response.setContentType("application/x-msdownload");
response.setHeader("Content-Disposition",
"attachment;filename="+name);
//获得response中的输出流
OutputStream out=response.getOutputStream();
//excel表格第一行标题,本例中不采用poi或jxl,只对每个单元属性后面添
//加\t,每行结束加\n。
这是excel文件的基本属性。
String head="id\tname\tupid\tlevel\n";
//编码应该根据本地编码来确定。
如果是台湾同胞,这里需要改为big5
out.write(head.getBytes("gbk"));
for(Address a:list){
//加上\t,\n等分隔符,写出文件,当文件以.xls命名时,打开即为普通excel文件String
s=a.getId()+"\t"+a.getName()+"\t"+a.getUpid()+"\t"+a.getLevel()+"\n";
out.write(s.getBytes("gbk"));
}
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public String findDetailById(int id) {
return addressDao.findDetailById(id);
}
}
13.action代码
package com.luo.ssh.action;
import java.util.List;
import com.luo.ssh.entity.Address;
import com.luo.ssh.service.AddressService;
public class AddressAction extends BaseAction {
//input
private int page=1;//页数
private int pageSize;//每页显示数量
private Address address;//用来接收对象参数
//output
private int maxPage;//最大页数
private List<Address> addresses;//数据集合
private String detailStr;//详细地址:xx省-xx市-xx县-xx镇
//属性
private AddressService addressService;
//方法
/**
* 列表显示
*/
public String list(){
int total=addressService.count();
maxPage=total%pageSize==0?total/pageSize:total/pageSize+1;
addresses=addressService.findPage(page,pageSize);
return"success";
}
/**
* 详细信息(下属子地址列表显示)
*/
public String detail(){
address=addressService.findById(address.getId());
addresses=addressService.findChildred(address);
detailStr=addressService.findDetailById(address.getId());
return"success";
}
/**
* 导出当前页
*/
public void pageToExcel(){
addressService.pageToExcel(page, pageSize,response);
}
/**
* 导出数据库全部信息
*/
public void allToExcel(){
addressService.allToExcel(response);
}
/**
* 导出当前地址的子地址
*/
public void childrenToExcel(){
addressService.childrenToExcel(address.getId(),response); }
public void setPage(int page) {
this.page = page;
}
public int getPage() {
return page;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageSize() {
return pageSize;
}
public void setAddressService(AddressService addressService) { this.addressService = addressService;
}
public AddressService getAddressService() {
return addressService;
}
public void setMaxPage(int maxPage) {
this.maxPage = maxPage;
}
public int getMaxPage() {
return maxPage;
}
public void setAddresses(List<Address> addresses) { this.addresses = addresses;
}
public List<Address> getAddresses() {
return addresses;
}
public void setAddress(Address address) {
this.address = address;
}
public Address getAddress() {
return address;
}
public void setDetailStr(String detailStr) {
this.detailStr = detailStr;
}
public String getDetailStr() {
return detailStr;
}
}
14.BaseAction类(只为方便使用response对象) package com.luo.ssh.action;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.interceptor.ApplicationAware; import org.apache.struts2.interceptor.ParameterAware;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;
import com.opensymphony.xwork2.ActionSupport;
public class BaseAction extends ActionSupport
implements RequestAware,
SessionAware,
ApplicationAware,
ParameterAware,
ServletContextAware,
ServletRequestAware,
ServletResponseAware
{
protected Map<String,Object> requestMap;
protected Map<String,Object> sessionMap;
protected Map<String,Object> applicationMap;
protected Map<String,String[]> parametersMap;
protected HttpServletRequest request;
protected HttpServletResponse response;
protected ServletContext application;
public void setRequest(Map<String, Object> arg0) { this.requestMap=arg0;
}
public void setSession(Map<String, Object> arg0) { this.sessionMap=arg0;
}
public void setApplication(Map<String, Object> arg0) { this.applicationMap=arg0;
}
public void setParameters(Map<String, String[]> arg0) { this.parametersMap=arg0;
}
public void setServletContext(ServletContext arg0) { this.application=arg0;
}
public void setServletRequest(HttpServletRequest arg0) {
this.request=arg0;
}
public void setServletResponse(HttpServletResponse arg0) { this.response=arg0;
}
}
15.index.jsp(主页)
<%@page pageEncoding="utf-8"contentType="text/html; charset=utf-8"%> <%@taglib prefix="s"uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<s:action name="list"namespace="/"
executeResult="true"></s:action>
</body>
</html>
16.list.jsp(列表显示)
<%@page pageEncoding="utf-8"contentType="text/html; charset=utf-8"%> <%@taglib prefix="s"uri="/struts-tags"%>
<html>
<head>
<style type="text/css">
center{
font-family: "黑体";
font-size: 30px;
}
thead{
color:blue;
font-size: 20px;
font-weight: 900;
}
.add{
background-color: #cccccc;
}
a:link{
color: blue;
text-decoration: none;
}
a:visited {
color:blue;
text-decoration: none;
}
a:hover{
color:red;
text-decoration: underline;
}
#page_no div{
width: 45px;
height: 45px;
text-align: center;
line-height: 45px;
border: 1px solid #cccccc;
display: inline;
}
</style>
<script type="text/javascript">
function listAll(){
var flag=confirm("全部导出可能花费您一分钟左右,确定全部导出吗?");
if(flag){
location="allToExcel.action";
}
}
</script>
</head>
<body>
<center>全国地名列表</center>
<table border="1"width="90%"align="center">
<thead>
<tr align="right">
<td colspan="5">
<div id="page_no">
<div>
<a
href="list.action?page=1&pageSize=${pageSize }"title="首页
">|<<</a>
</div>
<div>
<s:set name="prePage"
value="((page-1)/10)*10-9"></s:set>
<s:if test="#prePage>10">
<a
href="list.action?page=${prePage}&pageSize=${pageSize}"title="上一页"><</a>
</s:if>
<s:else><
</s:else>
</div>
<s:iterator begin="1"end="10"var="num">
<s:set name="p"
value="(page-1)/10*10+#num"></s:set>
<s:if test="#p<=maxPage">
<div><a
href="list.action?page=${p}&pageSize=${pageSize }">${p }</a></div>
</s:if>
</s:iterator>
<div>
<s:set name="nextPage"
value="((page-1)/10)*10+11"></s:set>
<a
href="list.action?page=${nextPage}&pageSize=${pageSize}"title="下一页">></a>
</div>
<div><a
href="list.action?page=${maxPage }&pageSize=${pageSize}"title="尾页">>>|</a></div>
</div>
</td>
</tr>
<tr align="center"><td>ID</td><td>地名</td><td>上级
ID</td><td>级别</td><td>操作</td></tr>
</thead>
<tbody>
<s:iterator value="addresses"status="status">
<tr align="center"
<s:if test="#status.count%2==0">
class='add'
</s:if>
>
<td>${id }</td>
<td><a
href="detail.action?address.id=${id}">${name }</a></td>
<td>
<s:if test="upid==0">
${upid }
</s:if>
<s:else>
<a
href="detail.action?address.id=${upid}">${upid }</a>
</s:else>
</td>
<td>${level }级地名</td>
<td><a href="detail.action?address.id=${id}">详情
</a></td>
</tr>
</s:iterator>
</tbody>
<thead>
<tr align="right">
<td colspan="5">
<div id="page_no">
<div>
<a
href="list.action?page=1&pageSize=${pageSize }"title="首页
">|<<</a>
</div>
<div>
<s:set name="prePage"
value="((page-1)/10)*10-9"></s:set>
<s:if test="#prePage>10">
<a
href="list.action?page=${prePage}&pageSize=${pageSize}"title="上一页"><</a>
</s:if>
<s:else><
</s:else>
</div>
<s:iterator begin="1"end="10"var="num">
<s:set name="p"
value="(page-1)/10*10+#num"></s:set>
<s:if test="#p<=maxPage">
<div><a
href="list.action?page=${p}&pageSize=${pageSize }">${p }</a></div>
</s:if>
</s:iterator>
<div>
<s:set name="nextPage"
value="((page-1)/10)*10+11"></s:set>
<a
href="list.action?page=${nextPage}&pageSize=${pageSize}"title="下一页">></a>
</div>
<div><a
href="list.action?page=${maxPage }&pageSize=${pageSize}"title="尾页">>>|</a></div>
</div>
</td>
</tr>
<tr align="center">
<td colspan="5">
<input type="button"value="导出当页到excel"
onclick="location='pageToExcel.action?page=${page}&pageSize=${pag eSize }'"/>
<input type="button"value="导出全部"
onclick="listAll()"/>
</td>
</tr>
</thead>
</table>
</body>
</html>
17.detail.jsp(子地址列表显示)
<%@page pageEncoding="utf-8"contentType="text/html; charset=utf-8"%> <%@taglib prefix="s"uri="/struts-tags"%>
<html>
<head>
<style type="text/css">
thead{
color:blue;
font-size: 20px;
font-weight: 900;
}
.add{
background-color: #cccccc;
}
a:link{
color: blue;
text-decoration: none;
}
a:visited {
color:blue;
text-decoration: none;
}
a:hover{
color:red;
text-decoration: underline;
}
</style>
</head>
<body>
<div>地名:${detailStr }</div>
<div>ID:${address.id }</div>
<div>上级ID:
<s:if test="address.upid!=0">
<a
href="detail.action?address.id=${address.upid}">${address.upid }</a> </s:if>
<s:else>
<a href="index.jsp">${address.upid }</a>
</s:else>
</div>
<hr>
<s:if test="addresses.size!=0">
<div>下属地名(<s:property value="addresses.size"/>):</div>
<table border="1"align="center"width="90%">
<thead>
<tr align="center">
<td>ID</td>
<td>地名</td>
<td>上级ID</td>
<td>级别</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<s:iterator value="addresses"status="status">
<tr align="center"
<s:if test="#status.count%2==0">
class='add'
</s:if>
>
<td>${id }</td>
<td><a
href="detail.action?address.id=${id}">${name }</a>
</td>
<td>
${upid }
</td>
<td>${level }级地名</td>
<td><a href="detail.action?address.id=${id}">详情
</a></td>
</tr>
</s:iterator>
</tbody>
<thead>
<tr align="center">
<td colspan="5">
<input type="button"value="导出当页到excel" onclick="location='childrenToExcel.action?address.id=${address.id}'"/ >
</td>
</tr>
</thead>
</table>
</s:if>
<s:else>
<div>该地名没有下级地名信息</div>
<a href="index.jsp">返回主页</a>
</s:else>
</body>
</html>。