该用户从未签到
|
新人报道,顺便问一下怎么样在让下面这个页面的数据能导出到excel表
- v) C! K- w0 v6 P
( V) ^ z! ~; l
/ ]- x* @# ~8 P; }& e. \7 P
- _4 L7 H1 z$ w2 j! b+ Y$ H代码如下:& K" z$ T( ?# N5 Y& A
* ]; T/ w* S2 b1 ^# r% b<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>( f# f; j' ^2 y/ r' m" V& S
<%" a8 w$ d% U" F+ O- _; J) j" @/ @
String path = request.getContextPath();7 B! i }" I; w
String basePath = request.getScheme() + "://"
: J; `; W4 ?9 p" p; Y + request.getServerName() + ":" + request.getServerPort()" @0 H. m6 C- h/ @% }$ J
+ path + "/";
H/ R- A& o+ \4 v* b: D! N%>6 e+ v" M4 H( C# @$ e$ g
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
0 G$ y) |0 S2 t1 f! [0 V3 q<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- h4 j$ ~! A$ m9 \2 ~7 e<html>% k* E0 e4 J+ ~- q) @2 C. r
<head>3 M- Y5 g6 J. Z1 S) I# b4 L1 x9 W
<base href="<%=basePath%>">
: f4 Y# w5 V; a9 d: I i. K: l5 t, e ]+ d
<title>采购信息</title>! g& a2 l( W3 _& R1 t
, G* j F; O8 T0 ^+ d' V# t
<meta http-equiv="pragma" content="no-cache">
; Y) q& [5 ~& Z+ A <meta http-equiv="cache-control" content="no-cache">
- X2 g; W* v. o- i1 M <meta http-equiv="expires" content="0">
7 `3 _3 f z- I! \, \* i2 c <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">7 g: [! r8 }: l
<meta http-equiv="description" content="This is my page">
+ t% f$ E5 y3 f, u7 Y <!--
+ h% |* z! Q4 z <link rel="stylesheet" type="text/css" href="styles.css">6 U: ]+ o/ e, F' [7 e( v
-->
; m4 T6 s& @0 N% ]" ^- L9 S( r7 J9 Q, P5 Z% W. c" f% t$ G! @
</head>
2 D& w: O4 F9 p/ m% L) n4 n <script language="javascript" type="text/javascript" src="<%=path %>/My97DatePicker/WdatePicker.js" defer="defer" >& r2 P3 Q7 y, }% `+ P
</script>" M' ^0 B: l: a0 x/ O9 o2 g% Y
<script type="text/javascript">
% j# T2 z3 k3 S" ^, J9 x; | V //添加按钮
, {8 q; A% a7 E9 v function add(){* ?, j: V1 m. d# m$ D# U0 z9 ?
document.thisForm.action="buyadd.jsp";
2 o" N( ]8 O) t% f document.thisForm.submit();
9 D, T+ ?% d: x2 Y/ f }
3 w5 K/ D5 x" {# y& Y' b _: q% f8 V$ O //修改按钮
, W# T( q8 N3 C# e. S9 O' X function change(id){
: l; P: g6 g) [) E9 a ?" G document.thisForm.action="OrderServlet?method=queryByid&flag=0&id="+id;$ r1 _9 `1 ]$ t" l2 E, n' ~# G
document.thisForm.submit();
7 g8 b" q# d4 Q, O+ U. T }//查询按钮
' Y6 q3 r, c+ x9 n% t //function query() {
; q: \2 P' P( y! p" S0 l' y* w //var oid = document.thisForm.oid.value;
`2 f: ]+ u2 r! D% u //var gname = document.thisForm.gname.value;
- S. i% R0 @+ Q6 d //document.thisForm.action="OrderServlet?method=queryid&flag=0&id="+oid+"&name="+gname;
& |6 ]1 Z* D a" x" Y0 i9 d' c //document.thisForm.submit();5 _2 Z2 K7 @: }0 |/ F. F
//}
4 J, w7 ?6 K: n- s9 F function search(){6 M& G+ f# o8 l' }* r4 V% k+ G
document.thisForm.action="ProfitServlet?method=queryList";# V( _* E( v0 i/ Y, \7 o
document.thisForm.submit();
9 Q3 U/ h/ B/ ?* P0 I) b4 ~5 X }# ]8 v7 `/ I) E) i
</script>
+ O- d/ [% y9 ^) Z6 q6 K <body>
( r5 {. J+ ^: C% o <form action="" method="post" name="thisForm">
" i5 Z# ? t! f' @, j5 T; Y2 T <table width="100%" border="0" cellspacing="0" cellpadding="0">- g. }$ l' D/ i
<tr>
- n2 G0 _9 D& y <td>4 ^# w9 b, r7 e7 M1 U7 |' K7 I3 s
<table width="100%" border="0" cellpadding="0" cellspacing="1"" l: q$ t9 z+ v; h3 m8 d% r
bgcolor="#c5dbed">
. k& A# U. E2 _+ o% ` <tr>
, g4 Q! t8 o! G- ~* ^ <th height="29" background="images/bg_MainTable.jpg">3 X& P- h! h/ T |* s; F p
<!--主表格标题 开始-->, D) l4 J$ M' v; y4 k, S; D3 u
<table width="100%" border="0" cellspacing="0" cellpadding="0">
7 O j: K7 S# W4 I }9 z( y <tr>
% T" |0 K Z( ~8 k; C <th align="left" class="STYLE1">
) P. m0 `' O+ {. y& h+ P( i 采购信息查询
1 G9 I7 D( V; L( S8 _. M </th>" [: ?$ b, N' `5 X5 \+ D& b `
<th width="57" align="left"># Z( R9 \+ y, n% {- u! S
0 A ]$ m9 V, t$ ?$ \
</th>
+ z. L4 S2 w& F' g </tr>
8 J0 M) Z2 W6 u" T. _& Q+ y; f </table>
3 s6 g- W- Q6 o0 `2 N9 p' d </th>
! J' W# |$ t) w! q/ R2 x& X </tr>% A. \8 z' k; o. t6 D0 Y+ x. f( o
<tr>
4 g! O& e! @9 t9 ~3 P <td align="center" valign="top" bgcolor="#FFFFFF">1 b- H$ B2 C/ k" l0 [
<table width="100%" border="0" cellspacing="0" cellpadding="5">
- U1 ~, ?) A3 x. r+ i0 u$ a {6 a <tr>8 C. a$ a6 `6 B
<td>* ^ C! P* R. e8 g/ V. N$ `
<table width="90%" border="0" cellspacing="0"9 a2 v k/ P( _4 l% d! f
cellpadding="5">- Z4 z I/ b5 {* n( Q% j+ N
<tr>
7 e) v/ K7 w3 l! H <td align="left">
9 [! R) ]. }7 o, S1 ?& i; u 采购编号:
' P/ R( ^2 M) l3 R. e/ I3 f <input type="text" class="inputbox_01"
# t) D1 f; e) p" `1 s style="width: 100px" name="oid" />+ h: h4 ^- y0 }) x! O6 z
</td>& X' ~. P5 W, r, o
<td align="left">( R6 U5 |* s# n
商品名称:- c1 l$ D p0 Z5 T8 H1 h0 k$ r
<input type="text" class="inputbox_01"1 ?: J1 h4 }0 F5 I) T
style="width: 100px" name="gname" />
" @) Y3 l" N3 r# h6 @, E </td>: \- U) X8 V5 O7 Z' |
<td align="left">! `- j* A0 Z* e
采购日期:' P5 O- V, W2 h K: c8 P6 Z. [
<input type="text" class="inputbox_01" style="width: 120px" name="starttime" value="${ticketInfo.datetime}" />3 y; q/ {! Q) G" j1 z1 { s. d+ I
至
+ i5 G* k8 x+ S7 ~- _ <input type="text" class="inputbox_01" style="width: 120px" name="endtime" value="${ticketInfo.datetime}"/>
( U0 X, t* {. {2 ` w5 L( L 7 m1 c) \) }& F; }
</td>3 ]/ ?8 ^, L9 r- b( Z& B* z
<td width="10%" align="right">
- ^ X- N# i& f, ]5 \9 o+ D% t; _' O <input type="button" name="button" id="button" value="查询"
/ S! \ u7 a3 S( l! I class="btn_01" />1 [# I! ]& _3 R+ F& C& W
</td>* O9 j: H; [* ]# s# _5 Y+ @) p/ H
<td width="10%" align="right">& _. i; _- w. q+ S- l6 K3 F
<input type="button" name="button" id="button" value="添加"
8 F% E7 b9 R* z. r class="btn_01" />
$ D8 @( [7 t9 G `, r </td>/ p+ s/ p# F8 h: c0 E2 ?
</tr>
; n& x! e8 }% r9 C </table>
! G4 d; Z8 A. ?* [0 h! R <!--查询区域 结束 -->! b& K1 h7 ~6 @% n2 q
</table>* \. r* Z: c% q% h( o9 T
[1 d0 e `: K/ t- ] </td>$ H' g) R9 ?- J
</tr>
, ?$ k# z8 K% e4 J- V' C
2 R- ?& b% S* @/ D <tr>
) L+ H/ E Y/ T s$ r( q- n <td height="88" bgcolor="#FFFFFF">1 r% k/ [1 r+ ?3 l- R. b( g# w; F
<table width="100%" border="1" cellpadding="0" cellspacing="0">
; L) F4 v. b3 ~+ M) C$ e | <!--子表格标题 开始 -->
, m3 y& h, h: H6 p* _2 n. ` <tr>
7 m) ~9 O" N& G) p <th width="8%" height="23" background="images/bg_MainTh.jpg"
9 [: Z( i1 j, t( Q5 x9 b class="color_254374">
4 v, e: s9 P, P/ U, d 采购编号$ `; W% o1 Z2 [$ u6 h
</th>
/ g! M2 E- \% P7 ?- z! p! a: M <th width="8%" height="23" background="images/bg_MainTh.jpg"# p" r6 w( y5 B
class="color_254374">
" e/ q6 u6 n# r/ [4 H* X 商品名称! Y6 J# i8 C/ ?% Y% b s+ k3 k9 [7 E
</th>
; N% T, B, G m, y) G <th width="8%" height="23" background="images/bg_MainTh.jpg"
+ B5 }! c5 ~# K9 u. Q0 O0 p: m- {7 A class="color_254374">
" A) N4 {9 u/ t' M4 Q 采购人员 Q! H+ I1 Y8 y/ w6 N
</th>& x0 c3 Z% Q& A) o; v' R
<th width="8%" background="images/bg_MainTh.jpg"
$ P" ^! n" v- }* E1 W2 q class="color_254374">
4 X0 ?0 U& c. L! k8 h+ e 采购数量0 s: H3 n* \9 q; I/ ?9 j+ U$ `" k/ F" P
</th> G) u; S& ~5 k/ L
<th width="8%" background="images/bg_MainTh.jpg"3 C; ?, Z1 q- a
class="color_254374">/ L( p; n6 @3 |+ ~; z& F' A7 s
采购价格; R( j) `( V4 X3 Q2 O* `
</th>* w% h0 E d4 \% K2 d# M
<th width="8%" background="images/bg_MainTh.jpg"0 u: G/ s8 m1 m5 b- q
class="color_254374">. G) \; y J+ ^/ N6 e6 B$ \
采购日期
' o z! J: H- l# r0 d, ~ </th>
) W7 S/ ]& @; z/ v# Z <th width="8%" background="images/bg_MainTh.jpg"
) N* L8 b' H! R& N4 H/ a/ S: r class="color_254374">0 O) Y8 g9 V" s
操作/ X* z6 E6 }& j9 R/ T: M: \, p
</th>
! a C" {; r0 D% S0 d$ E </tr>
4 j; L( i5 O) [8 c3 r* L! H. g <!--子表格标题 结束 -->+ e. D7 i9 `) ~" c! I: V2 Q
<!--子表格列表 开始 -->
: `$ @2 }9 W/ G4 V# y <c:forEach var="map" items="${list}">
$ y5 K7 L" N( O( t4 T5 e <tr>/ p7 k7 G% M/ w \) G7 ~7 t; I" I
<td align="center">
) g# n) Z% s; \7 |: b, y ${map.o_id }+ m8 U7 a- C1 L7 P# L; H9 U! L
</td>
; k% ?' R! L( s: c <td height="24" align="center">
6 e+ s9 g& K) x. C/ z; G ${map.g_name }9 n! m( _4 s3 Y
</td>
7 q t; ?% J" w' X <td height="24" align="center">" h( n3 A, u, n. F6 u8 M
${map.p_name }
2 M3 W7 f+ t' D, J# d </td>' H, Q3 w8 ^) S/ d% S T" w2 z7 U* k2 D
<td height="24" align="center">
6 Z& j4 K7 T9 ^; j. i: f1 n+ s4 H ${map.o_count }4 ~( x h! I+ J7 B9 E" t4 h# E
</td>
: I: R2 Q" w$ F! ?: S2 g; a8 o <td height="24" align="center">
/ U6 X) d& G$ K+ O2 r6 `8 N+ D' I ${map.o_price }3 {% ^% c- `+ N5 a
</td>
+ C* [* R% k* b I' O8 y1 o <td height="24" align="center">
# y2 a; u* x b0 Q ${map.o_date }9 y, h( C* D) u, L) F" J t
</td>
# ^8 \9 u; N0 n& B6 g <td align="center">
9 @. r/ M. l* b& |7 u0 V <input type="button" name="button" id="button" value="修改"
& f4 J- h L" m& A class="btn_02" />/ \% E! N5 f' q- i0 G1 @! g9 r, o4 S
</td>
; H% k( U& |! v' M% s </tr>/ g* ]# m0 T, M' N' a: P
</c:forEach>( ?1 l; Y J; |! P/ x' Q) r
</table>
/ D" s: p' I6 b% Z7 {) B <!--子表格列表 结束 -->
* b7 D; Z8 }' \" k3 d </td>
- z2 N2 Z8 @' l3 I </tr>& G: ?( l, E9 i/ _7 k
</table>
/ D2 M1 r. [. K: ?3 w" ]2 t o7 L, G( G- x! ^1 h
<table>$ h% J8 q4 z+ U5 s; i
<tr>0 P" u' v1 s' U: {
<td align="center">
9 J/ ^8 N0 R6 d$ L 当前第${requestScope.pageNo}页,共${requestScope.totalPage}页
) C0 `# p- d& @+ ?) a n3 t </td>
6 J" i; L& p: |! m& L <c:if test="${fg==0}">
% m1 v+ l7 y C: h <td align="center">/ }) D' Y% ]! `8 p9 f
<a href="OrderServlet?method=query&flag=0&pageNo=1">首页</a>1 X, {- c9 M% L, y. D( }5 Q0 @
</td>9 _8 d1 z0 L8 D
<td align="center">3 j+ M* {2 @" t. ^# w% R
<c:if test="${requestScope.pageNo>1}">1 O- ~$ p8 ]7 P$ k- c4 C
<a
# U* e/ G" a- E/ H href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo-1}">上一页</a>
) Y& O/ D' y! ]* U% B& W </c:if>
* n# @' \/ ^' R) ?0 z, a+ u </td>
# j: r0 [/ Y4 t5 K! y9 r4 Z7 o <td align="center">7 D% L# X9 h$ }8 ?7 w+ x
<c:if test="${requestScope.pageNo<requestScope.totalPage}">
3 J# _6 O$ o) Q' n <a' ?* z# N) Q3 b$ G0 k: d# e/ w
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo+1}">下一页</a>$ D: f8 W" H; i% d1 P2 n
</c:if>
! k N4 j1 r( F/ V* Y0 N </td>9 ^ ?8 W* y8 P) D1 x
<td align="center">
3 N# b6 P; b$ X! @ <a; [$ Y0 K" y) L' w" H4 [+ b: q" Z# H
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.totalPage}">尾页</a>. k. q2 A# e' V
</td>, Q/ s2 x$ O5 o9 b$ x* z
</c:if>. X- u! d# D) D+ w
</tr>
' w* M1 ? v; y$ w: G1 v </table>1 G' v1 k- q4 A
</table>* a5 u; P6 W, U" ^6 r& x' B; o
</body>! f2 e1 M2 A6 }1 u; J3 _/ v- h
</html>
& W3 _# f0 z7 Q8 I# t! ]' ]8 W5 x+ e
2 x0 P- l3 Y$ o, e. W2 R' F9 b7 |- m# L- P7 k
|
|