各位兄弟姐妹们帮个忙好吗?
(java)jsp页面上有个"导出"按钮,点击导出后想把结果集(集合rs-此集合已经把数据库中查出的数据封装到集合里)中的数据导出到自己想要保存的目录下。也就是说点击"导出"按钮后,页面弹出个window对话框,可选择保存目录。
想要源代码
小弟先谢谢了。。。哈哈。。。
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
这个问题没弄过,关注一下,sql优化的资料很多,你搜一下就很多的。
这里有一个
http://download.csdn.net/source/970487
------解决方案--------------------------------------------------------
導出文件名為table.txt
- Java code
<% String txt = (String)request.getAttribute("txt"); response.setContentType("application/txt"); response.setHeader("Content-disposition", "attachment;filename=table.txt"); BufferedOutputStream bos = null; try { bos = new BufferedOutputStream(response.getOutputStream()); bos.write(txt.getBytes()); } catch (IOException e) { throw e; } finally { if (bos != null) bos.close(); } %>