该用户从未签到
|
新人报道,顺便问一下怎么样在让下面这个页面的数据能导出到excel表
O6 \& j" B+ F( I
9 V; B' _6 ]6 p/ |/ T
9 t9 S' `9 f* F Z% P4 ]! R: T- m: W) Q
代码如下:
$ M' l3 `- @! s' G
, O" ^. h1 }* Q2 x<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 A5 k% p% e( x. x7 q<%" t: @7 ?7 F, V" Q5 T8 r
String path = request.getContextPath();
& [2 N l% J# `- o String basePath = request.getScheme() + "://"1 ?' G3 w4 j8 q9 p! h) J0 H
+ request.getServerName() + ":" + request.getServerPort()
, r H' P& E7 Q + path + "/";% n/ @0 e$ i& ` h, ^ A
%>
! ]+ m6 e/ n( T6 t, v ]<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
) m) W5 x, ?, y0 O F2 q<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">5 @3 I1 e3 ~3 |
<html>
. Z$ S9 s# n5 d/ t- {' } <head>: r8 ^% t; f& I- U, Y+ k
<base href="<%=basePath%>">
0 |# ~7 \+ a) h" C! ^% @6 M/ [2 o- y+ D$ N8 J @
<title>采购信息</title>
) I+ B0 t5 ^: u1 n3 u4 V( N; A3 ]# }
<meta http-equiv="pragma" content="no-cache">" z& F' F" r" U" ~8 a8 D7 N
<meta http-equiv="cache-control" content="no-cache">
0 x% G9 i! K2 ]% K2 r1 x2 w <meta http-equiv="expires" content="0"># U1 i$ {' x- c
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
- {' ]+ @+ [1 Y, C <meta http-equiv="description" content="This is my page">
; f5 b3 H4 S' Q6 J+ Z1 M <!--+ _2 s+ g! X- D- T$ ^( U
<link rel="stylesheet" type="text/css" href="styles.css">, b/ I$ b, W- O; T7 X# |8 K/ J9 b
-->9 i( e* y, n& i6 V" V8 o/ y0 L
. ~# Z7 v8 E. D' x
</head>8 J! a; _' `8 |! U' U! T
<script language="javascript" type="text/javascript" src="<%=path %>/My97DatePicker/WdatePicker.js" defer="defer" >6 d; y$ c, W/ w& p! V
</script>- R4 j; p8 c3 R5 a# }
<script type="text/javascript">" C& K/ \8 O/ H7 q8 X/ x0 F# Q) ]6 y
//添加按钮+ ` Z' R/ X2 m% c# d$ J
function add(){
: `: s) A& M" S9 D document.thisForm.action="buyadd.jsp";
* ?/ Z2 I5 p) C) O document.thisForm.submit();2 z, Z, Y# ~' w- Z' R' Z/ o4 b
}; k/ b4 A1 O( P1 |$ z2 @* f- S
//修改按钮8 \5 G$ {% k3 h
function change(id){4 g9 U! q: }, I; M, v4 S9 v) P7 o
document.thisForm.action="OrderServlet?method=queryByid&flag=0&id="+id;$ J4 R; r ~7 Y) j) Q
document.thisForm.submit();- @( n) X3 z' S5 V6 J+ e$ M
}//查询按钮
1 ]; \/ p) c! j) ?7 X //function query() {# L/ T& u* U6 u. e9 X$ `* A: u7 [
//var oid = document.thisForm.oid.value;
' m; u7 `9 z* ?; H( _+ N0 c //var gname = document.thisForm.gname.value;2 m+ e; o; k, ? e' `& T) I8 D
//document.thisForm.action="OrderServlet?method=queryid&flag=0&id="+oid+"&name="+gname;- w8 d0 O: r/ ?8 V! s
//document.thisForm.submit();
* z6 C/ Q3 Z. p0 M //}1 U5 W" a9 T& ~$ t2 w
function search(){
4 b% B4 O* b" I' I4 L7 Q document.thisForm.action="ProfitServlet?method=queryList";
+ O6 V& L$ n* x" W% K O9 u document.thisForm.submit();+ Z! F. \8 z Y B9 S1 w3 s, ^2 k
}! e W+ J% `0 {' v7 M Q. J
</script># [* B- Y+ S; `( B5 `5 Q4 B
<body>
* ^8 N" ^% H+ ~# u <form action="" method="post" name="thisForm">, S! M# M2 d x2 w
<table width="100%" border="0" cellspacing="0" cellpadding="0">" p4 U5 [/ \( W% |# o
<tr>
% S+ O, U& R$ h+ y <td>
' K4 v* @: t# D, I, }$ p" f& [- J <table width="100%" border="0" cellpadding="0" cellspacing="1"
# F6 t9 }& ?* B; s$ y bgcolor="#c5dbed">
9 }2 s& W: i; R <tr>
& i' A: C x* e% D <th height="29" background="images/bg_MainTable.jpg">
. Z1 i/ b! Y/ s" y; g3 ] <!--主表格标题 开始-->' ^5 N0 S! @7 c
<table width="100%" border="0" cellspacing="0" cellpadding="0">
) ] q/ d# \# e# ?+ D1 P <tr>
* k2 h8 ` J& `4 m3 r$ o3 N T <th align="left" class="STYLE1">' y" o: k# F, J- _0 Z; l% l
采购信息查询) j( `$ q1 L) p8 M1 s
</th>
4 F9 J" I. F1 V6 J <th width="57" align="left">( Q3 C' ~9 A0 u" I% [
- u3 ~) X5 B9 `1 z* Y- i4 |: L
</th>
: i% Z7 o9 x; M' x( B' o </tr>
1 V6 t. x% u' L+ ?- Y1 x3 W </table>" @0 O; X4 Y! U& J3 f
</th>
2 O' F6 s) u+ E, u+ l) a </tr>
1 `# i) E. `1 L; q% C% e <tr>" h1 p4 K. P) p" J
<td align="center" valign="top" bgcolor="#FFFFFF">
3 c n3 f$ b% } M <table width="100%" border="0" cellspacing="0" cellpadding="5">7 R% T. U. F2 H7 Q6 P9 P W
<tr>( X$ h$ \( f' H# s$ w* a
<td>3 `3 j$ w3 ^7 \" }
<table width="90%" border="0" cellspacing="0"
$ S, c; Y" r7 k- Y6 a4 |! r cellpadding="5">+ r" G+ h. W+ |) X7 i# Y+ U
<tr>1 _* h- j) X5 u+ T8 b- c
<td align="left">/ J2 ?% p( E M
采购编号:
+ s1 D6 ~" x+ b/ g. s3 @4 m <input type="text" class="inputbox_01"2 W7 m7 r& ^2 R& [2 \- b
style="width: 100px" name="oid" />
7 b, `& w+ t$ L; z; R2 A </td>7 L; V/ V+ y: f3 G
<td align="left">1 @' k4 T( {) g
商品名称:
, w# K, G5 ~& h: W3 L3 l <input type="text" class="inputbox_01"
6 _- k+ s+ _- m# ] style="width: 100px" name="gname" />
% b& X2 ~) J3 P0 X </td>9 d3 c7 |5 |# X+ ]$ M& D7 L
<td align="left">
. G4 O& G2 x w 采购日期:
5 b8 Q7 B1 a9 C* v- B <input type="text" class="inputbox_01" style="width: 120px" name="starttime" value="${ticketInfo.datetime}" />& j2 g/ k9 y8 x
至. R1 q8 K" ?' ~2 Y8 p% p3 q
<input type="text" class="inputbox_01" style="width: 120px" name="endtime" value="${ticketInfo.datetime}"/>
" W6 u8 [- Y5 f# D 2 n% i7 T6 Q$ W+ m- R
</td>0 c0 T* A! o, g
<td width="10%" align="right">
: I# m; _) L5 G" ^+ d <input type="button" name="button" id="button" value="查询"
7 n1 T# x! n% V: z4 |' ~ class="btn_01" />- [3 ^0 G" B# F
</td>' O8 a0 Q: @7 F) d. m; F
<td width="10%" align="right">) N* r5 V ?0 c
<input type="button" name="button" id="button" value="添加"# @& ^1 T/ v0 A6 U4 D h7 s
class="btn_01" />
) C. I4 p c& C) S7 B- [$ Q: w: z5 w# S: r </td>
. x% Q* p, E* O </tr>: P3 E! w2 E& h, t: u
</table>6 ^9 ?- t% n ~: |8 }' Y2 V
<!--查询区域 结束 -->' A) O% W, }+ Z O1 A- \* Z1 O" o9 C9 y
</table>
# p- m& V, s N9 `+ ?* |
' J3 f$ S0 c$ W+ [6 d+ Q( I </td> ~$ B9 I x: P) ^( v! w3 @
</tr>
9 r j! _' z6 a1 D5 X
$ P d3 a `5 d& { <tr>
$ W. \0 [- e1 T' m% ~2 d2 W9 L <td height="88" bgcolor="#FFFFFF">& p2 E" u3 E. E2 W& q1 R. C$ t1 }; P
<table width="100%" border="1" cellpadding="0" cellspacing="0">. y( s6 C4 W9 }" L# Q3 r& ]# T
<!--子表格标题 开始 -->, ?: F2 a% k/ K3 N, ^
<tr>
" c8 x' `/ h. m; U' n <th width="8%" height="23" background="images/bg_MainTh.jpg"4 C1 y% s% Q' i! O% {) g& B8 [3 \% P
class="color_254374">
/ z( j: K1 p' { 采购编号
' Q2 ?% O; K+ q6 V </th>
3 j3 u( e" N9 [0 L: k. _ <th width="8%" height="23" background="images/bg_MainTh.jpg"
* ?) \, y# G& M1 O class="color_254374">6 W1 k f7 v! w9 j
商品名称3 o# j; K; ~: x" F) D
</th>
6 l8 D4 j" x) j. e" v1 ~1 l <th width="8%" height="23" background="images/bg_MainTh.jpg"
" ^2 \% w* M& F& _) s class="color_254374">4 N: H' Y" k z0 _
采购人员
0 Y6 L; I5 l' {& ]) h </th>: t b8 d- W, }9 m! X& q
<th width="8%" background="images/bg_MainTh.jpg"9 V$ s& y' \3 o" [9 a
class="color_254374"># D# c6 z9 d# W: m9 M3 Y
采购数量5 C$ ?6 g4 M* E# C8 u
</th>6 D* N3 H" ^' d7 w6 {) O
<th width="8%" background="images/bg_MainTh.jpg"
8 V; i: J+ u7 m3 p8 o( o class="color_254374">% w0 |. t; v' w3 _; [
采购价格
- @( t& |- m" m) P6 B% e </th>0 x, b* ?3 ]/ Y+ g7 a. E
<th width="8%" background="images/bg_MainTh.jpg"
1 Z- }) a/ L+ Q% k8 V class="color_254374">
, E$ i9 _" E/ h: M1 ^% C 采购日期
/ z5 N! p& p% @3 e& n- d! E5 {* E </th>
2 e: w0 {% P6 ]& n; w <th width="8%" background="images/bg_MainTh.jpg"
: u! w3 i" s! I m( d+ z; c z class="color_254374"> n8 U1 u X5 j7 J# A" ~
操作' e4 E; V7 F, j# o% Y
</th>, `) ~0 I: {% \( I5 Y5 {& }
</tr>
& Q) V6 U# h) T+ L6 S. c <!--子表格标题 结束 -->! e! R7 D" a' c k
<!--子表格列表 开始 -->
1 k5 n. Q7 R$ w4 L <c:forEach var="map" items="${list}">
$ j/ m. V5 r3 t1 u; }+ r" [( u <tr>) M* ^. \* e- U' M
<td align="center">+ i. m) C: t4 a' g/ l* S# S
${map.o_id }. a$ y* o- |; I* f9 N
</td>
8 ~; G- t6 ]9 k/ j+ b$ @6 G. K; X7 G2 [ <td height="24" align="center">3 i E8 d' S! m
${map.g_name }6 @" N3 s8 s! Z$ t6 f) X
</td>
: M, s' T2 s% g% E) I8 f) f0 ~ <td height="24" align="center">
# X+ h0 [9 y a$ d8 O$ H3 m" Z" i ${map.p_name }3 U1 X; x4 e2 V
</td>
2 e# ?3 U9 M) w+ D) }- F <td height="24" align="center">
2 r. [4 d. h9 z+ o2 D ${map.o_count }
* I' K& I. T' j3 R: T! j2 s </td>
8 N# ?& J8 M) p3 O0 ~) e1 E <td height="24" align="center">
+ S& }7 C/ |1 ?, z0 r. Y1 x2 z ${map.o_price }; n: X' O }3 ?. E" A
</td>
2 f. [+ D7 T" M <td height="24" align="center">
& }4 y* w2 W1 t: u0 K/ ~ ${map.o_date }
- {* S5 D x( V$ M1 {; X$ \# T </td>
! y' j7 h0 q, ]9 e$ i O <td align="center">
8 q3 D1 t$ F3 a6 C) E <input type="button" name="button" id="button" value="修改"
1 ]& B8 d- z: h/ M1 F. A7 W5 h class="btn_02" />1 L( t, k. |/ U7 _9 Q5 z/ V- b
</td>9 u: n8 r2 u9 i# q6 R) R; |
</tr>
0 T, ^! P3 ~+ _& r) D( e7 @( V </c:forEach>( p4 {: _: `& U0 w; U
</table>. o# e: Q6 `# C# {8 ^) V( b" K
<!--子表格列表 结束 -->: T- ?( ?' }+ X& C% V& \0 U8 O5 \ m6 p
</td>8 K, ]" A! y$ }' ]
</tr>
- W6 M$ H0 Z* }7 q </table>! F8 Y$ ^* W2 n/ g
& d2 m s7 X8 x* E2 @3 O
<table>
" M7 D* W) M0 {! |6 ?8 q- X <tr>1 F7 n/ A& K. I: C9 U, E
<td align="center">
7 b2 }8 t( @7 w z 当前第${requestScope.pageNo}页,共${requestScope.totalPage}页, `, C$ W2 N" G
</td>
/ \; y% Z" j9 m. G6 |5 a0 V8 s <c:if test="${fg==0}">( b: y' L8 b" w* A' P1 S
<td align="center">
; {! F% d M0 L% T3 E( J( }1 ~ <a href="OrderServlet?method=query&flag=0&pageNo=1">首页</a>
8 m; O9 i+ m8 a1 S- L! } </td>1 f% Y2 c6 K5 ]; N
<td align="center"># }1 E+ o2 g# g5 j
<c:if test="${requestScope.pageNo>1}">
" w+ V8 w2 k S0 b# l9 l <a5 D0 l7 j7 N0 y" ?
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo-1}">上一页</a>0 `& F* }* V8 `/ f8 }0 U
</c:if> t9 T( L0 k$ V* d; w
</td>
0 j3 L& d# z3 B* \0 J! |1 S* R( ^ <td align="center">% b- H7 y2 A6 G P6 s0 X
<c:if test="${requestScope.pageNo<requestScope.totalPage}">
6 b& V& L8 E2 m' d <a
! b1 L" |2 L: T- j" Y href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo+1}">下一页</a>1 @# {5 W+ ^1 K( \
</c:if>3 }( q: I( S$ H) b3 w% y( ?0 @
</td>0 E8 Q; _, {$ s2 N& v
<td align="center">! @! d: Y6 K2 @+ k
<a9 y6 ?1 s1 [. X! c
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.totalPage}">尾页</a>
) G% [+ D1 b3 V- w- t c2 [ </td>
! e0 e9 J/ N3 r2 `+ _ </c:if>' |. V/ F2 s( h3 N; Y
</tr>
% O& w# T8 Q* W$ n </table>
2 e2 E% s; H# G' r8 h; M# _ </table>) I" \/ K% H. x& u7 [* V% W
</body>; o/ [8 ~6 P! z
</html>" v( {* _- O3 m! j0 n( r1 L
, n4 ?2 Q/ Q' I- y. I
3 f' ^* k' q7 a3 ` |
|