appfuse:Excel导出
1.pom.xml
1 <dependency> 2 <groupId>org.apache.poi</groupId> 3 <artifactId>poi</artifactId> 4 <version>3.2-FINAL</version> 5 </dependency> 6 <dependency> 7 <groupId>displaytag</groupId> 8 <artifactId>displaytag-export-poi</artifactId> 9 <version>1.2</version> 10 </dependency>
2. displaytag.properties
1 export.excel.class=org.displaytag.export.excel.ExcelHssfView 2 export.pdf=false 3 export.xml=false 4 export.csv=false
3.jsp页面
display:table 的属性export="true"
设置导出文件名称:
<c:set var="now" value="<%=new java.util.Date()%>" />
<display:setProperty name="export.excel.filename"><fmt:formatDate value="${now}" pattern="yyyyMMddHHmmss"/>.xls</display:setProperty>
自定义列的导出
<display:column sortProperty="createDate" sortable="true" titleKey="createDate" media="html excel">
<fmt:formatDate value="${createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
</display:column>