|
该用户从未签到
|
新人报道,顺便问一下怎么样在让下面这个页面的数据能导出到excel表
. a/ Z' g( {& @$ B+ L2 H
4 P+ S0 i# ^4 U7 P9 C, X$ q Z5 }4 x$ v7 @1 \ ~( y8 F7 f f
9 |+ t( ?7 R- S. Y& I v+ X
代码如下:: G/ |1 u( ]2 t2 ?* d' c7 }/ w
0 |) X. ^6 g# p0 O. f# w9 c, w
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>0 y# V& R1 r& F6 @
<%. _5 Q+ O ?$ o" e% o5 F0 m
String path = request.getContextPath();
& _3 _) @6 ~. ]* }& J9 \ String basePath = request.getScheme() + "://"! x/ A( f' I" ~* o- l6 w
+ request.getServerName() + ":" + request.getServerPort()0 z2 t5 P/ U, S8 T4 @
+ path + "/";
( x- P F4 w! d# c9 h7 @%>! W5 B0 g6 M! W* O
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>" h/ I4 v2 N2 e( f/ K8 ]4 \; b8 s7 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">- H0 o1 c/ E: C9 v* A$ P
<html>2 S2 G* V" q% P' o% F* l3 s
<head>" |8 U3 ]( d" u5 X0 `/ L8 c
<base href="<%=basePath%>">2 j+ E, E& R4 i% k- a4 h }
" b: S& Z5 w% N( r+ v+ P <title>采购信息</title>
* V( U1 l. T' q4 b e: E1 U5 N+ D2 W2 g% C1 t3 \
<meta http-equiv="pragma" content="no-cache">
. d% \% }% K- }1 t2 z <meta http-equiv="cache-control" content="no-cache">
: @' `5 k+ |% U6 R <meta http-equiv="expires" content="0">4 `0 K7 q2 _+ Z* I; ?) F. u
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">9 g9 }; ?" a: F- b' r, `; Q) Y
<meta http-equiv="description" content="This is my page">* e: s8 q, [. |
<!--5 ]* K, w/ F+ h
<link rel="stylesheet" type="text/css" href="styles.css">
" ?: A7 R0 g0 Y% J5 F$ R; T% J -->- s2 @1 x! r0 P @ ~6 o* u8 d
. j. u$ N+ [4 X
</head>
& }6 R! {' R6 ~7 J, g9 t' l <script language="javascript" type="text/javascript" src="<%=path %>/My97DatePicker/WdatePicker.js" defer="defer" >- q2 ~1 ?; j2 Z, _- t
</script>- j4 r5 i9 |4 q! s
<script type="text/javascript">
( \ y$ b* H* f: _2 R; u5 r //添加按钮
! p. t' |, q$ Y" w# Z6 @, Y function add(){
; a8 J' P3 l7 o9 {2 r7 U document.thisForm.action="buyadd.jsp";0 d0 c. j" E' ~; f
document.thisForm.submit();
! a; ?% L8 ~# P' j$ D }
3 y v0 u) I0 d# p& ^+ E //修改按钮" h$ t2 }" U% U( H+ F8 w- C1 G0 z
function change(id){
, R% y% s- O4 P document.thisForm.action="OrderServlet?method=queryByid&flag=0&id="+id;. A3 P2 l% g9 q% w: A
document.thisForm.submit();7 r# ^( u# b6 N9 J, ~% M
}//查询按钮5 q' @3 {1 |2 c: L" d' a
//function query() {
7 c! g: a( D x$ q" o( g! ?7 c //var oid = document.thisForm.oid.value;
' V! X; w7 ~! j4 ]' P //var gname = document.thisForm.gname.value;
0 n; A/ G/ O$ q5 n( N$ R/ x# U6 ] //document.thisForm.action="OrderServlet?method=queryid&flag=0&id="+oid+"&name="+gname;8 Z3 [- G! S! J+ L; A( T
//document.thisForm.submit();
. p; Q! K; x1 e //}" m$ L9 h d* }" d, a
function search(){( u, d! `2 e: K
document.thisForm.action="ProfitServlet?method=queryList";
* u* |* j' m6 k- P8 [5 Z! f document.thisForm.submit();( R: G6 z2 X/ J' X% O
}
* W4 F8 `3 a4 ^( j( q; |3 `2 G </script>
8 Y9 `% c8 O. f q9 j) K3 s <body>( o3 p ]- t4 k: n7 {8 [! O% n0 U
<form action="" method="post" name="thisForm">
4 W1 [6 a1 q4 K+ {" K <table width="100%" border="0" cellspacing="0" cellpadding="0">4 Q9 _% F" ]" s6 w9 l3 F; U
<tr>7 T' V/ V% B" r6 X0 M; ~, e
<td>& y* Q% C3 x# U$ X* s
<table width="100%" border="0" cellpadding="0" cellspacing="1"
! x# y9 V4 \/ D y% f5 o3 Q bgcolor="#c5dbed">
# i: V( f6 r( I" ? <tr>" w9 T8 @6 H( B. X6 G0 A8 d
<th height="29" background="images/bg_MainTable.jpg">
: F6 s) a5 H0 Z9 a <!--主表格标题 开始-->8 h( a- i9 l" r. p, P. E* p
<table width="100%" border="0" cellspacing="0" cellpadding="0">! s! T, N9 `4 y) a# V
<tr>* N8 F+ t% V3 V! s/ N
<th align="left" class="STYLE1">
3 r9 y, w( K6 g 采购信息查询" m' P9 W O. c2 W+ a
</th>
+ P# U8 G9 X3 Z <th width="57" align="left">4 W4 U, r# M2 C$ _( f) |$ t
; D9 j- `% z }9 C6 S0 n </th># n4 t9 H& b. |. v
</tr>
1 `3 e$ z R! ^# G: p9 R. j </table>
/ r2 U8 k4 R- @+ W/ m9 R </th>
3 r Y. \5 I1 p: @) V </tr>/ R! i, {/ U% D' i9 Y
<tr>( N' Y% P$ K+ o4 y/ j2 A9 l
<td align="center" valign="top" bgcolor="#FFFFFF">: M) ~8 p1 _# d# a2 b. L# U
<table width="100%" border="0" cellspacing="0" cellpadding="5">: B' B. Y S( F; y/ p+ M7 [
<tr>* p7 Z7 W2 Q9 u: K
<td>* i8 ?1 B% Y, L b
<table width="90%" border="0" cellspacing="0"4 D6 k9 l2 J: |1 ~& E$ E# r
cellpadding="5">
G9 ~* k8 L. d, [ X, P b- d <tr>, j) X+ M- `. b8 \
<td align="left">
`& _( }4 Q r! { 采购编号:
( l. S2 s' B. _4 m# ] <input type="text" class="inputbox_01"
. |- W* V1 I8 X) } style="width: 100px" name="oid" />3 H" s" C6 b8 U9 P7 m/ [
</td>( r) s3 J) S6 ]% |
<td align="left">5 `0 m7 u( I0 c
商品名称:4 X. r. _! q* y. H
<input type="text" class="inputbox_01"
* U f ], `3 E' r- J style="width: 100px" name="gname" />
' ?: z. r; Y4 o* W' |( Y </td>! ^+ r k2 l- Y* e& P
<td align="left">
0 y2 [7 N n6 x, r! m a: P 采购日期:
* A% e- _7 Q6 w <input type="text" class="inputbox_01" style="width: 120px" name="starttime" value="${ticketInfo.datetime}" />, t, Y2 C$ R" D2 j8 t1 R
至
: h( O& u3 V9 } O- N" ?: ] <input type="text" class="inputbox_01" style="width: 120px" name="endtime" value="${ticketInfo.datetime}"/>
! g9 U2 P# c8 k
& I+ K. @. G, A. y) Z </td>! k8 y+ {' o5 E" ?- N6 T2 }# R) i s0 K+ p: m
<td width="10%" align="right">! x0 j0 ~5 [. e+ }( s4 Q3 Y6 ]8 e0 n
<input type="button" name="button" id="button" value="查询"# R# O9 T0 _, @9 X
class="btn_01" />! Z0 l9 o/ X3 r [4 X# U
</td>
3 C. R1 N* w: v0 n8 T <td width="10%" align="right">
: z) k0 ?( |4 e: {- q <input type="button" name="button" id="button" value="添加"
! ~; t, D. K9 t$ A5 n2 w" y6 O class="btn_01" />' @( i7 t/ u* i
</td>
! ?* f _* Q& K </tr>
' B, D$ s- `8 n; a </table>
1 h' @1 V2 F7 F" E6 e; p q- h <!--查询区域 结束 -->$ K- [+ N8 {* X$ A0 [
</table>
) [% t* `5 W U% t8 u: x- s& n7 \0 H* M% L
</td>/ p2 v; }3 B! ^! r: C
</tr> e) W$ w4 ~7 y) ]: m) g6 V
6 R( T' f& y& [. Q! r% m( ?, v
<tr>
% l1 c; K2 _: R) S <td height="88" bgcolor="#FFFFFF">3 k% q: K; y( @3 P0 ^+ Q
<table width="100%" border="1" cellpadding="0" cellspacing="0">+ W9 b# G; @ |5 x. E
<!--子表格标题 开始 -->. `) b: a, s6 R" ~
<tr>
/ y$ Y# Z% E/ g0 H* R& H8 y( A <th width="8%" height="23" background="images/bg_MainTh.jpg"
0 A) K# g& H: g8 f- o3 E, Z class="color_254374">, D! I5 P" ^0 r/ F/ Y7 v2 X% G; S
采购编号. @% q0 l% L; P' \; |0 E0 I
</th>: E# ?) `- @+ S) C: ?5 l# l
<th width="8%" height="23" background="images/bg_MainTh.jpg"
3 P7 f6 d7 d# X% W) y- U4 @ class="color_254374">
7 B8 }) ?1 Y+ |( d7 E 商品名称
3 F4 V0 X1 y- y8 `6 E </th>4 r9 v; ^3 K# \5 g: r
<th width="8%" height="23" background="images/bg_MainTh.jpg"5 u; X7 q! a: Q* e# B* k7 Y
class="color_254374">
' K8 O4 b4 r& ~* m* w7 T; M 采购人员
; u4 L% `8 e; H& A* c( i, W </th>
6 N: N5 t" a( w1 V& z( p <th width="8%" background="images/bg_MainTh.jpg"
) v- a2 v2 z l# q' U class="color_254374">
/ C8 `/ c& P. a4 r6 r w 采购数量* ^! I& ~- g" b2 p
</th>
/ v S' \' L8 F; M/ _; ` <th width="8%" background="images/bg_MainTh.jpg"
: i2 e k \6 D7 }5 B6 y/ P class="color_254374">
$ e* v& d+ ^/ C$ R K8 K 采购价格
3 w+ u) r$ M4 G& a </th>
1 u* D/ c K$ U% D. { <th width="8%" background="images/bg_MainTh.jpg" |! ^0 |: y3 } V% s9 H. U( e
class="color_254374">
) a. D* S4 x+ J. a 采购日期7 D4 Q, g+ G B7 q |2 |8 V
</th>
3 T: y* q9 S5 m. u% J7 { N <th width="8%" background="images/bg_MainTh.jpg") l/ e) R/ Z( W; i/ d1 b- \
class="color_254374">
& O0 {! s: @" d4 b8 \/ \ 操作' |9 D O0 B% {5 C1 o8 b" z& a
</th>
0 ^3 u/ S1 S% x/ L% `5 |! K </tr>3 |! g9 I4 b& {& w1 k
<!--子表格标题 结束 -->9 h; i8 i1 J$ U9 F& g b, b/ o
<!--子表格列表 开始 -->
7 U3 S) Q, Q8 ? <c:forEach var="map" items="${list}">
0 o0 I& z- ]! M. r: Q, k* x+ w <tr>8 l% G& a8 N8 a4 i
<td align="center">
, s) t* ~) p2 [% c5 Q# a ${map.o_id }
% i5 m( H- R1 l; x) h/ z( s" _ </td>. y* V# W- s! ~1 J
<td height="24" align="center">1 @/ x+ i; j8 h0 w8 p) ]# C
${map.g_name }
f" o6 ~+ I5 @% L </td>8 ]# F4 C1 X: a( q2 s
<td height="24" align="center">
9 _9 |( V" T9 _' a$ M. a ${map.p_name }7 T* W. ^% h" _3 {
</td>/ j) b. _3 D3 U% ~
<td height="24" align="center">2 Z( O) w0 d4 r$ B0 Z3 Y; \( f7 w2 P' ^
${map.o_count }
a9 k. O. M5 |5 \6 x6 I% w </td>
5 G4 M5 {/ K7 {+ j4 t/ p& _ <td height="24" align="center"># Q& A: V; m9 y/ Z8 x* q5 }1 W$ S
${map.o_price }
a+ v/ K& ?; a* Y. ~# Y </td>
4 }6 {& `$ a% N- r! W <td height="24" align="center">7 h; X& ] r a* k1 E4 X7 H3 r
${map.o_date }9 O" y0 d6 Z" ` T8 |
</td>
* a3 l- i+ j) f( U! ]$ t( [ <td align="center">
3 L% b7 h4 o4 q/ v: F7 B <input type="button" name="button" id="button" value="修改"
3 D5 L4 t/ D" O2 E0 }" D class="btn_02" />4 [- }: k* a) m5 x% I* X* ^
</td>
- Y' d* Q8 M5 ?$ z </tr>
, d0 {% S& N. n1 M1 | </c:forEach>0 x* G7 U- C. b6 `5 c. Y8 I
</table>
' Y# Y; A, L: s <!--子表格列表 结束 -->6 T9 ?* q$ H1 P9 r5 Z8 j
</td>
$ q5 U1 ^0 c3 c& X </tr>
7 ^4 q' Q+ I2 ` </table>+ D# L% i$ Z) x
! s3 R! \) q7 M6 z2 ^
<table>; U9 S$ Q5 G1 u% n
<tr>/ k) |' w6 U: M' ~& a7 R) _
<td align="center">' B% v2 a- E' x- K, p' {! x
当前第${requestScope.pageNo}页,共${requestScope.totalPage}页1 D" R7 B. Y3 ]$ m, r+ ~
</td>
; J7 F+ H; F7 k# ?% F' j <c:if test="${fg==0}">; H4 m5 L! a2 H5 z) W5 h
<td align="center">% o; \7 l7 P7 H; h8 {3 p( f& T; u
<a href="OrderServlet?method=query&flag=0&pageNo=1">首页</a>
. x: P z1 P. d( ?4 ?8 l# d </td>
/ B& \/ G: o' S$ }' X! Y <td align="center">+ F* c7 I, _% i+ @1 Z: m
<c:if test="${requestScope.pageNo>1}"># G; {2 N) c; m8 ]/ D7 H5 N
<a
7 j( o2 v5 A3 B( O; b7 \, j href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo-1}">上一页</a>3 e( m* v; v( ]# Z& C ~# |
</c:if>* P4 x% i1 l. c: d& r7 ?2 [6 w
</td> H( T) }5 f( `$ T
<td align="center">1 P- k& F# n$ e( y Y8 p( H
<c:if test="${requestScope.pageNo<requestScope.totalPage}">) n8 m4 x! q$ H' u
<a# ]# ^' b4 j' E+ D
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo+1}">下一页</a>6 m0 Z3 K$ w9 ?. | s$ Q& m
</c:if>
! e; `7 \4 G& e </td>
6 |/ p, K& C# P# P) D" o <td align="center">
' w( {- T3 z9 L+ j" c7 n <a6 k2 h% b( ^0 h! i
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.totalPage}">尾页</a>
# i* {% l; s6 `- G+ ] Z </td>" f6 \" C" J- b- k, w
</c:if>
; n3 J7 s$ `2 w4 l. k7 Y/ l </tr>% P0 C; C$ X# K; z. M" E* Q' E
</table>7 |) Q0 ]+ A% J- x4 L: j7 i' v
</table>
5 J" V9 k( ]* E. [" T </body>( u& k2 Q- A% Y# b/ O: N
</html>2 b' [% K, Y, ^8 J7 R" P
4 ?' X2 H2 g3 S F$ V2 f9 s3 p
- U5 g% J) H. {1 M) { |
|