- 爱易网页
-
Java教程
- JSP页面导出word文档求解解决思路
日期:2014-05-17 浏览次数:20811 次
JSP页面导出word文档求解
JSP页面是这样的 数据已经取出来了 传form对象到后台
<form name="f1" action="out" method="post">
<table border="1">
<tr><td height='30' colspan="2"></td></tr>
<tr>
<td width="50%">资产数量</td>
<td>资产总金额</td>
</tr>
<tr>
<td><input type="text" id="num" disabled="disabled"/></td>
<td><input type="text" id="sum" disabled="disabled"/></td>
</tr>
<tr>
<td colspan="2">资产明细列表</td>
</tr>
<tr>
<table id="t1">
<tr>
<th><input type="checkbox" name="chkAll" id="chkAll" onclick="ChkAllClick('chkSon','chkAll')"/></th>
<th>资产细目</th>
<th>资产名称</th>
<th>资产编号</th>
<th>资产单价</th>
<th>原使用人</th>
<th>数量11</th>
</tr>
<s:iterator value="list">
<tr>
<th><input type="checkbox" id="chkSon" name="chkSon" onClick="GetRow()"/></th>
<th align="center" ><input type="text" disabled="disabled" value="${XIMU }"/></th>
<th><input type="text" disabled="disabled" value="${MINGCHEN }"/></th>
<th><input type="text" disabled="disabled" value="${BIANHAO }"/></th>
<th><input type="text" disabled="disabled" value="${DANJIA }"> </th>
<th><input type="text" disabled="disabled" value="${SHIYONGREN}"/></th>
<th><input type="text" disabled="disabled" value="${SHULIANG}"> </th>
</tr>
</s:iterator>
</table>
</tr>
<tr><td colspan="2">
<input type="button" value="统计" onclick="tj()" class="btn" />
<input type="button" value="删除" onclick="del()" class="btn" />
<input type="submit" value="导出" class="btn" />
</td>
</tr>
</table>
</form>
后台是这样的
public void out(){
if(f1!=null){
String fileName="";
fileName+="评价报告.doc";
try {
HttpServletResponse response = ServletActionContext.getResponse();