新人报道,然后问导出到excel的问题
新人报道,顺便问一下怎么样在让下面这个页面的数据能导出到excel表代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>采购信息</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<script language="javascript" type="text/javascript" src="<%=path %>/My97DatePicker/WdatePicker.js" defer="defer" >
</script>
<script type="text/javascript">
//添加按钮
function add(){
document.thisForm.action="buyadd.jsp";
document.thisForm.submit();
}
//修改按钮
function change(id){
document.thisForm.action="OrderServlet?method=queryByid&flag=0&id="+id;
document.thisForm.submit();
}//查询按钮
//function query() {
//var oid = document.thisForm.oid.value;
//var gname = document.thisForm.gname.value;
//document.thisForm.action="OrderServlet?method=queryid&flag=0&id="+oid+"&name="+gname;
//document.thisForm.submit();
//}
function search(){
document.thisForm.action="ProfitServlet?method=queryList";
document.thisForm.submit();
}
</script>
<body>
<form action="" method="post" name="thisForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="1"
bgcolor="#c5dbed">
<tr>
<th height="29" background="images/bg_MainTable.jpg">
<!--主表格标题 开始-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th align="left" class="STYLE1">
采购信息查询
</th>
<th width="57" align="left">
</th>
</tr>
</table>
</th>
</tr>
<tr>
<td align="center" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
<table width="90%" border="0" cellspacing="0"
cellpadding="5">
<tr>
<td align="left">
采购编号:
<input type="text" class="inputbox_01"
style="width: 100px" name="oid" />
</td>
<td align="left">
商品名称:
<input type="text" class="inputbox_01"
style="width: 100px" name="gname" />
</td>
<td align="left">
采购日期:
<input type="text" class="inputbox_01" style="width: 120px" name="starttime" value="${ticketInfo.datetime}" />
至
<input type="text" class="inputbox_01" style="width: 120px" name="endtime" value="${ticketInfo.datetime}"/>
</td>
<td width="10%" align="right">
<input type="button" name="button" id="button" value="查询"
class="btn_01" />
</td>
<td width="10%" align="right">
<input type="button" name="button" id="button" value="添加"
class="btn_01" />
</td>
</tr>
</table>
<!--查询区域 结束 -->
</table>
</td>
</tr>
<tr>
<td height="88" bgcolor="#FFFFFF">
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<!--子表格标题 开始 -->
<tr>
<th width="8%" height="23" background="images/bg_MainTh.jpg"
class="color_254374">
采购编号
</th>
<th width="8%" height="23" background="images/bg_MainTh.jpg"
class="color_254374">
商品名称
</th>
<th width="8%" height="23" background="images/bg_MainTh.jpg"
class="color_254374">
采购人员
</th>
<th width="8%" background="images/bg_MainTh.jpg"
class="color_254374">
采购数量
</th>
<th width="8%" background="images/bg_MainTh.jpg"
class="color_254374">
采购价格
</th>
<th width="8%" background="images/bg_MainTh.jpg"
class="color_254374">
采购日期
</th>
<th width="8%" background="images/bg_MainTh.jpg"
class="color_254374">
操作
</th>
</tr>
<!--子表格标题 结束 -->
<!--子表格列表 开始 -->
<c:forEach var="map" items="${list}">
<tr>
<td align="center">
${map.o_id }
</td>
<td height="24" align="center">
${map.g_name }
</td>
<td height="24" align="center">
${map.p_name }
</td>
<td height="24" align="center">
${map.o_count }
</td>
<td height="24" align="center">
${map.o_price }
</td>
<td height="24" align="center">
${map.o_date }
</td>
<td align="center">
<input type="button" name="button" id="button" value="修改"
class="btn_02" />
</td>
</tr>
</c:forEach>
</table>
<!--子表格列表 结束 -->
</td>
</tr>
</table>
<table>
<tr>
<td align="center">
当前第${requestScope.pageNo}页,共${requestScope.totalPage}页
</td>
<c:if test="${fg==0}">
<td align="center">
<a href="OrderServlet?method=query&flag=0&pageNo=1">首页</a>
</td>
<td align="center">
<c:if test="${requestScope.pageNo>1}">
<a
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo-1}">上一页</a>
</c:if>
</td>
<td align="center">
<c:if test="${requestScope.pageNo<requestScope.totalPage}">
<a
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo+1}">下一页</a>
</c:if>
</td>
<td align="center">
<a
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.totalPage}">尾页</a>
</td>
</c:if>
</tr>
</table>
</table>
</body>
</html>
可以 参考 下 http://www.52itstyle.top/thread-29653-1-1.html admin 发表于 2016-10-31 10:26
可以 参考 下 http://www.52itstyle.top/thread-29653-1-1.html
非常感谢,:handshake
页:
[1]