JSP生成word文件
1、jsp生成word文件。直接改动jsp格式:
<%@ page contentType="application/vnd.ms-word;charset=GB2312"%> <%@ pagepageEncoding="GB2312"%> <% String fileName ="word.doc"; byte[] bt =fileName.getBytes("GB2312"); String unicoStr = new String(bt, "ISO-8859-1"); response.setHeader("Content-disposition","attachment; filename=" +unicoStr); %>
2、jsp设计动态表格
建一个表框架,事实上就是表头,列出表的第一行,显示细表的数据项名称
<table width="200" border="1" id="myData"> <tr> <td><input type="button" value="添加" onclick="add_row()"></td> <td>型号</td> <td>类型</td> <td>材料</td> </tr> </table>
详细的表格设计,參考:http://blog.csdn.net/leniz/article/details/570146