该用户从未签到
|
新人报道,顺便问一下怎么样在让下面这个页面的数据能导出到excel表
( h' x& \8 @' }1 P1 x
4 @9 N& {/ V1 ~; q
; V- }* d* k& G; N+ e
T1 J1 y( C1 p4 h. R/ T* D
代码如下:, j7 ~8 W2 w5 s) t$ f% ]
: ^. w% t. A0 j9 ^ Q( }
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
! `* Q" S0 |" N<%
0 T7 m( {3 ~1 q0 i$ _; W+ B, B$ z5 b String path = request.getContextPath();: A$ J/ _" V- ~2 U
String basePath = request.getScheme() + "://"
0 s5 D/ m7 S: z3 n; B1 G + request.getServerName() + ":" + request.getServerPort()
0 i+ c* f6 l2 r( ^+ d* Y + path + "/";
5 d, c2 {) e6 @) X9 d%>
5 a( i& v% W; r8 L: H7 ] M+ k! n<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
. l" f# r( s, Q. T<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
1 u/ }( O8 g. Z5 q" ?5 } Z<html>' U: y" B) t8 I& c8 B2 d
<head>! @, H$ u6 m# D( s( d1 A
<base href="<%=basePath%>">9 |' c+ ?& C- o3 v1 ?0 m5 L
8 K9 p, P( e$ _5 E
<title>采购信息</title>
8 |2 y9 Q# f+ ~. O8 Y- h& } g( A* w# q
<meta http-equiv="pragma" content="no-cache">
$ B0 r+ U# }5 d) h <meta http-equiv="cache-control" content="no-cache">0 @* K9 ?4 ?, a6 j; D( U8 D
<meta http-equiv="expires" content="0">
3 T0 W o) W- { <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
! v: d; i, T( L8 B1 i' d) I <meta http-equiv="description" content="This is my page">' W- F2 i& V/ j7 ^, {* s
<!--+ P x v% c" I" I; R) Q# H' r% a4 d
<link rel="stylesheet" type="text/css" href="styles.css">
$ }9 M+ ^( F4 c7 }8 y. c- D -->
3 x* k2 f5 O6 E
; U. _. ?7 N/ {8 N+ q. U; Y </head>: m$ u9 Y, _7 z: A |9 \
<script language="javascript" type="text/javascript" src="<%=path %>/My97DatePicker/WdatePicker.js" defer="defer" >
9 q. y0 e/ q% A# N; ^ E" [</script>, A) [$ y, l7 ?
<script type="text/javascript">7 @, F- u+ l* B( c2 O3 @0 _( S" O
//添加按钮
6 b% G8 B6 K9 [" c; w% X function add(){
% m" w- V& S% D document.thisForm.action="buyadd.jsp";- {/ C& n% r# H% X( j* h {: u
document.thisForm.submit();
3 ?& e4 u& H2 {$ E2 U3 _' F2 J. [ k }; s9 k; t, A7 D+ t/ R" ^
//修改按钮
* `5 x x+ f" q function change(id){
$ a ~% P8 f R, x% [ document.thisForm.action="OrderServlet?method=queryByid&flag=0&id="+id; r9 [; F0 V) V! H1 R
document.thisForm.submit();
) Z2 T* `4 s f s+ O( ]2 v }//查询按钮
8 p3 n* G2 I+ K) y //function query() {
" ` I# z" S9 ~' U5 N //var oid = document.thisForm.oid.value;2 O+ \- U1 d" n- ~
//var gname = document.thisForm.gname.value;
" _6 ~( \) {8 _ Z4 R$ @" a //document.thisForm.action="OrderServlet?method=queryid&flag=0&id="+oid+"&name="+gname;
7 D' R6 p$ l0 Z //document.thisForm.submit();
4 E, ~: h& d9 A //}+ P9 n7 ^( y9 V5 g* {8 X% U
function search(){2 |6 \5 T4 {& ~4 e. Z7 E
document.thisForm.action="ProfitServlet?method=queryList";
6 i" O* H- G4 _: {' D9 J document.thisForm.submit();' H8 p8 Y8 x. O8 [ ^8 W
}
3 _8 A# P3 u$ b) w+ \" t </script>
& N- P$ i$ [# I+ \/ m; c7 d/ R, t <body>
1 V i) m n" C, @7 L <form action="" method="post" name="thisForm">
2 Y- B" F' w- w <table width="100%" border="0" cellspacing="0" cellpadding="0">
: x: t+ L0 c7 d. L <tr>
$ \4 b- L4 b) |3 L* W' f6 w <td>7 C+ h* i5 ^% _7 y( T* P, Z% D1 C
<table width="100%" border="0" cellpadding="0" cellspacing="1"
& Y+ Z0 R$ f( \7 I- m+ t. _ bgcolor="#c5dbed">* m9 f: } s0 \& V
<tr>
4 ^; O$ P6 k! m9 S <th height="29" background="images/bg_MainTable.jpg">9 `4 |/ k2 ^. k+ t, S
<!--主表格标题 开始-->
% v: N( Y5 f$ f/ Y ?8 L0 g <table width="100%" border="0" cellspacing="0" cellpadding="0">
0 V) n4 R2 A: n! S+ `, p. t% e <tr>4 N8 P5 H+ X8 j' o
<th align="left" class="STYLE1">
, f' L! A f; L& H 采购信息查询5 v$ d- i8 y3 B/ s" R3 }
</th>- f- U. I9 e5 Z& |+ j
<th width="57" align="left">& F0 f9 b G; c ]) p/ P
5 P2 j; ?: Y; W
</th>
4 t8 k- I; c7 N. S </tr>! t* R- F' Q; K
</table>
& L7 f, ~! _% I, T5 q+ I </th>6 X3 u3 b1 I9 C% B! ]
</tr>
" O" s& `6 {$ B) [" Z <tr>' u$ W/ w# K( ?. `" V
<td align="center" valign="top" bgcolor="#FFFFFF">
9 _* j8 _1 _; I <table width="100%" border="0" cellspacing="0" cellpadding="5">
0 N/ _; ^9 \$ G" M* U <tr>
' x% x! P9 k; ] <td>
7 w% D! {; v/ C <table width="90%" border="0" cellspacing="0"; Q2 x0 p. y9 t t4 d* [' ~4 D
cellpadding="5">
* _4 e0 T; h# v# g4 S <tr> E4 u) H* L! ?9 }0 w
<td align="left">
" c2 m! |" `$ y& L; ?' \ 采购编号:, @( j: G! G7 d5 t* R
<input type="text" class="inputbox_01"
- R1 W V6 `& r* ~8 m style="width: 100px" name="oid" />
) z$ ~4 Y& [: n5 |* [4 H </td>/ i2 k, f5 i2 R. b" S
<td align="left">
* f f1 A7 s8 F 商品名称:# i5 H1 d r6 d6 u+ `# d/ t2 H
<input type="text" class="inputbox_01"
. F" s: D( i k style="width: 100px" name="gname" />. z8 R% j& {% M' V
</td>" T. N; |" a2 ?; v5 E% n Z
<td align="left">
; ]' W' N: D' O* S& F% L5 f 采购日期:
k3 C& M4 E' g2 p- a& S <input type="text" class="inputbox_01" style="width: 120px" name="starttime" value="${ticketInfo.datetime}" />8 X" U: T' t" [; v) }& f
至
w# c3 \3 Y4 V" B# o <input type="text" class="inputbox_01" style="width: 120px" name="endtime" value="${ticketInfo.datetime}"/>) {* z" G ?5 w; K& v0 m9 V
5 g0 f J9 |7 {3 z6 O0 V </td>! Z# D# q6 j1 Y7 l0 B
<td width="10%" align="right">
( {3 ?" W2 N, R4 W/ t <input type="button" name="button" id="button" value="查询"
0 g0 e& `& E% R; z( G. T% f class="btn_01" />+ p: O7 f5 ]# T5 @* t
</td>
: B1 G; J: s0 v& ~ <td width="10%" align="right">
6 `; j1 B! P: f z0 q0 e' @/ V9 v <input type="button" name="button" id="button" value="添加"
* }0 z k" b( Y class="btn_01" />
7 P: @# F5 L/ M q( X' Q9 O </td>
8 q8 Y3 K r A x( y </tr>
' \& [$ U/ V2 O! F! X </table>( V0 f+ |% }- L: `! a1 `
<!--查询区域 结束 -->, _" ?& t0 w+ O0 O
</table>
4 d% K. a ^2 x: }! R' M9 Q* x5 t$ ]5 q W# A
</td>
, g# z( g' O9 Y8 y8 v3 M3 d7 r </tr>5 w# Q$ c1 o0 o9 @! }' t8 T
c9 ?( l5 M3 B9 I4 G' ] <tr>
! D- a8 q5 m$ Y) B% R <td height="88" bgcolor="#FFFFFF">4 q5 W7 l: q2 [$ k3 Q' M
<table width="100%" border="1" cellpadding="0" cellspacing="0">/ z$ u( r. t! X3 O0 q/ n
<!--子表格标题 开始 -->
+ {! _( Q5 j; y3 ~ <tr>% S2 q1 v6 Y' k& Q/ q; ]$ J# ?/ F7 U
<th width="8%" height="23" background="images/bg_MainTh.jpg"6 K- N% y( N' G
class="color_254374">+ L2 h \; y; g* s& H5 p4 ^# q
采购编号
6 N6 u2 g2 f; S </th>
6 b% ~; j1 K2 o9 u: I; I1 g1 g <th width="8%" height="23" background="images/bg_MainTh.jpg"
4 c! e) ^, _0 n) O7 O class="color_254374">- G, ?6 v( K- }. f, l1 ` y
商品名称
" j6 X* \1 H O5 L4 ]2 @4 s1 p2 U </th>4 x; S \, j: `) g: ?& I
<th width="8%" height="23" background="images/bg_MainTh.jpg": {) n+ {9 A4 x" v3 }8 f
class="color_254374">
1 z; |2 L2 ~& g3 p) q7 `7 | 采购人员
2 a/ B! ]" }4 d {, S. g </th>
# Y: q1 w! C1 `9 p( ` <th width="8%" background="images/bg_MainTh.jpg"" O& y* y8 P0 n2 @% E
class="color_254374">
' K- f5 Y' t9 p: l( N$ z) X* X2 k 采购数量8 F" e# o' C+ _' @6 O p
</th>
1 r+ F( @- x" M0 N- L# i <th width="8%" background="images/bg_MainTh.jpg"+ f, [, f0 E* v: R. H
class="color_254374">0 x Y' E {! b6 v9 }
采购价格0 B" G4 M i' V, ~3 I) {9 R
</th>' K B/ ]" ~, A+ e) x* b" L9 |# S, [
<th width="8%" background="images/bg_MainTh.jpg"
( `0 ~' R( a' ]0 K- w* @# ]4 i class="color_254374">
7 A1 m/ X& R: ~% b K 采购日期- J$ s# ?4 {8 L) [
</th>. Z) C, V- M/ G }% t9 t1 h, b
<th width="8%" background="images/bg_MainTh.jpg"2 p& l! o Y0 [, h" q |7 S3 r, W
class="color_254374">7 i* i) H! U% t( I- ]" Z8 R8 l
操作
% }, O; J7 K6 X </th>
: l8 W- Z! ^2 D0 M' A) k </tr>9 r; s4 g; H& s, q# D
<!--子表格标题 结束 -->
/ O1 q5 J6 P6 r- S) H. o V/ E' b. ~ <!--子表格列表 开始 -->
! T' j' Y! E+ l: E8 @ l <c:forEach var="map" items="${list}">
& L* @0 K$ y) J <tr># x9 b, G' e) s9 I
<td align="center">
5 b8 D) Q2 Q7 l1 B, }) \" u$ V ${map.o_id }+ q% g/ z# V$ Y" R2 ?+ I9 j
</td>8 E& @& }% o/ E* A! m6 j. p
<td height="24" align="center">) i/ @& H5 l+ j1 D' L: O! w7 r1 y8 n* \
${map.g_name }% [% n Z8 _) b# Y% P
</td>
$ D5 Z" F& [& w" ^ <td height="24" align="center">; ~* b9 n; K- }
${map.p_name }$ s& x7 g6 \& T! H2 N
</td>
- K u( r- G$ v% V <td height="24" align="center">
* c8 E2 k4 A" x ${map.o_count }7 @. r) u" T- O2 u) B( _
</td>
( ]) U+ }* ?* r0 r$ Z C <td height="24" align="center">- q0 U0 ?. }/ J5 ?# M; M3 X; M2 J
${map.o_price }
2 n2 o9 I4 k2 Y+ K. A) T6 V( m </td>
& O5 A j' H3 |& q& t5 R+ B <td height="24" align="center">
5 {3 {6 m, Y3 }% @; f ${map.o_date }( J' C- ], w5 j7 X$ y" E# k
</td>
5 j; |9 z9 |$ k8 `+ P <td align="center">
: p8 [1 Z2 M& Z+ g( y5 o <input type="button" name="button" id="button" value="修改"" j: t, D2 g1 V5 u. @
class="btn_02" />+ M2 F! W4 ^: K. P% l% P4 A
</td>4 b% U3 v2 j7 C. p6 l
</tr>
" d" v5 P! @2 h9 y# Z: X </c:forEach>: i( F. m7 y$ K5 d4 q& h0 _. W, Y: C
</table>5 J! s% Y$ b M$ s" Z
<!--子表格列表 结束 -->' a! ~ W5 {# v' Y: m1 n
</td>
3 F: Q: K1 |; k+ G# j </tr>2 }2 d& L8 f2 T) h
</table>
' K4 f! k2 H$ T1 `5 x- p; }- J3 c7 E% b9 x0 U7 d
<table>
; C* {& k1 q. w K5 q <tr> ^) Q) q/ W) a$ L
<td align="center">
9 y5 N/ B9 Z# i3 ?" [ 当前第${requestScope.pageNo}页,共${requestScope.totalPage}页' ^0 B w! I2 P0 N, Q' B' H, e& K$ q
</td>! O& |2 Y* P H5 {# K
<c:if test="${fg==0}">/ c+ t) d) x6 d C z7 ]1 j
<td align="center">
' r; J, i2 F8 [$ r8 g <a href="OrderServlet?method=query&flag=0&pageNo=1">首页</a>
2 {9 q s4 l/ G) ~9 _# n' x! T! c </td>6 E P" j/ I8 v* s- q% n
<td align="center">
' l- O4 _! u/ w* |! b: W <c:if test="${requestScope.pageNo>1}">
5 w" J0 R S$ U <a
. _- O4 z5 c3 Q U9 U2 ~& G+ J href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo-1}">上一页</a>1 m5 U" u: {/ N5 k9 d" D
</c:if>0 z w- ?( W& Z& l/ q+ h3 V2 r
</td>; x3 h; I' E, y" B( T0 B
<td align="center">
$ h/ n: m# i" m3 ` <c:if test="${requestScope.pageNo<requestScope.totalPage}">
- v) h" L8 `4 p <a
% b' Y5 {. c9 h/ r. t( {: O href="OrderServlet?method=query&flag=0&pageNo=${requestScope.pageNo+1}">下一页</a>
& k. Q* u" K2 z </c:if>/ S; I, A( G7 Q, |( f5 C. Y9 ^. C5 i% `
</td>
4 I2 G. o- U( Y: I& {: N3 `0 { <td align="center">
1 K' E' p, `! v4 u. M# p8 Z <a, h6 O: _; i. p4 D. B8 d
href="OrderServlet?method=query&flag=0&pageNo=${requestScope.totalPage}">尾页</a>- m- o; i$ y$ G) Q3 @/ |7 K
</td>' k2 u& ~% B4 m
</c:if>; Y' d; d! Z8 K4 u/ A
</tr>
}& T: M& Z" U k* W+ T </table>+ ~, b0 P' C, r
</table>
2 ~4 J6 M& F+ \# T; W </body>
8 S5 U+ f7 x: ?</html>% j! m% `$ ~; _6 H& }, G) X
$ o/ m( x6 \! ~* N9 p7 j
$ e5 X+ @' f. d3 L2 r: i* K |
|