How to export table displayed on jsp to pdf in java strust2(java - 如何在java strust2中将jsp上显示的表格导出为pdf)
问题描述
这是我以表格格式显示的数据.我想在不使用struts2的显示标签库的情况下以PDF格式显示.
This is my data display in table format. I want to show as it is in PDF without using display tag library of struts2.
<table border="1" align="center" style="border-color: #CCCCCC; border-width: 1px; border-style: None; width: 1320px; border-collapse: collapse;" id="tablepaging">
<tbody>
<tr>
<td>Leave ID</td>
<td>FROM DATE</td>
<td>TO DATE</td>
<td>DAYS REQUESTED</td>
<td>APPROVER</td>
<td>NOTES</td>
<td>REMARK</td>
<td>IS PLANNED</td>
<td>REASON</td>
</tr>
<tr>
<td>270</td>
<td>12/27/12</td>
<td>12/29/12</td>
<td>2</td>
<td>Sagar</td>
<td>s</td>
<td>s</td>
<td>true</td>
<td>s</td>
<td>
<a href="/HRIS_Updated/cancelRequest.action;jsessionid=A2313340A50DD2DAB054714BF65AB08B?leaveId=270" id="submitinvoice;jsessionid=A2313340A50DD2DAB054714BF65AB08B_">Cancel</a>
</td>
<td>
<a href="/HRIS_Updated/requestHistory.action;jsessionid=A2313340A50DD2DAB054714BF65AB08B?leaveId=270" id="submitinvoice;jsessionid=A2313340A50DD2DAB054714BF65AB08B_">History</a>
</td>
</tr>
</tbody>
</table>
是否可以使用 javascript 或 jquery?
Is it be possible with javascript or jquery?
请帮我提供一些代码,我已经在 Google 上搜索了几天,但一无所获.
Please help me with some code I have googled it for a few days but get nothing.
推荐答案
在jsp上使用显示表可以很容易的将其转换为*pdf以及.csv,.excel等,这是示例代码;
Using display table on jsp would be quite easire to convert it to *pdf along with .csv,.excel and son on,Here is the sample code ;
<display:table id="data" name="${questions}" requestURI="" pagesize="10" export="true" >
<display:column property="label" title="UXVlc3Rpb24=" sortable="true"/>
<display:column title="R3JhcGggQW5hbHlzaXM="> <img src="JHtpbWFnZVBhdGh9JHtyZXBvcnREYXRhLmNsaWVudE5hbWV9LyR7ZGF0YS5sYWJlbH0ucG5n"/></display:column>
<display:setProperty name="export.pdf" value="true" />
</display:table>
这篇关于java - 如何在java strust2中将jsp上显示的表格导出为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:java - 如何在java strust2中将jsp上显示的表格导出为pdf
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01