Hibernate3 提供了DetachedCriteria,使得我们可以在Web层构造 K/d&c]
8lGgp&ey
detachedCriteria,然后调用业务层Bean,进行动态条件查询,根 C(*@-Npf[
j=QR*8*
据这一功能,我设计了通用的抽象Bean基类和分页类支持,代码来 GhQ`{iJM
.'mC3E+$
自于Quake Wang的javaeye-core包的相应类,然后又做了很多修改 F20-!b
.-~%w
。 $#JVI:
*]{I\rX
分页支持类: f#Cdx"
<\>ak7m
java代码: RYJc>
SVWSO
:O+b4R+
package com.javaeye.common.util; rkc%S5we
{#M{~
import java.util.List; >37}JUG
x Bw.M{
publicclass PaginationSupport { 'yRv~BA
mf_'|
WDs
publicfinalstaticint PAGESIZE = 30; m9w
;a
m:O2_%\l
privateint pageSize = PAGESIZE; I"<.
h'
]sP9!hup
privateList items; ZjW| qb
!enz05VW6.
privateint totalCount; EjE`S_i=
XTaWd0Y
privateint[] indexes = newint[0]; !;C(pnE
*"sDaN0@R
privateint startIndex = 0; ,vw`YKg
%vYlu%c<
public PaginationSupport(List items, int Eq;frnw>q
"(&`muIc
totalCount){ bK%tQeT
setPageSize(PAGESIZE); KBHKcFk
setTotalCount(totalCount); /r@
setItems(items); YgOgYo{E!
setStartIndex(0); c
O>:n
} 6@ ^`-N;
pYUkd!K"
public PaginationSupport(List items, int .+o>
rPvX8*)tV
totalCount, int startIndex){ ,;pX.Ob U
setPageSize(PAGESIZE); V*uu:
setTotalCount(totalCount); }4]x"DfIg
setItems(items); 'wV26Dm
setStartIndex(startIndex); V="f)'S$
} ^l9
*h
TFNU+
public PaginationSupport(List items, int q ? TI,
Jd6Q 9~z#
totalCount, int pageSize, int startIndex){ ;OqLNfU3y
setPageSize(pageSize); 5<?$/H|7T
setTotalCount(totalCount); b=\3N3OX
setItems(items); n7.lF
setStartIndex(startIndex); NfN6KDd]2L
} <%uZwk>#
rWKLxK4oU
publicList getItems(){ \1D,Kx;Cb
return items; `9{C/qB
} sc>)X{eb
u`,R0=<4
publicvoid setItems(List items){ A_U0HVx_
this.items = items; K
:ptfD
} N ] /d
3"D00~
publicint getPageSize(){ >8t[EsW/
return pageSize; &`2*6
)qa
} _!1c.[\T
y+R$pzX
publicvoid setPageSize(int pageSize){ #N}}8RL
this.pageSize = pageSize; z4:09!o_
} pvxqeC9`
W?Abx
publicint getTotalCount(){ g c=|<(
return totalCount; -3U}
(cZ*
} 7B"aFnK;[J
|noTIAI
publicvoid setTotalCount(int totalCount){ $:Zxb
if(totalCount > 0){ lfd{O7 L0b
this.totalCount = totalCount; Z i&X ,K~
int count = totalCount / 3PeJPw
ED&KJnquWJ
pageSize; W\Y
4%y}
if(totalCount % pageSize > 0) q`zR 6
count++; S^=/}PT'
indexes = newint[count]; 30`H
Xv@
for(int i = 0; i < count; i++){ n :kxG
indexes = pageSize * ~36XJ
<QLj6#d7Y
i; )@M|YM1+
} *9^k^h(r&4
}else{ me\)JCZpb{
this.totalCount = 0; 5*Iz3vTq
} ')~HOCBSE
} s5#g[}dj
824%]i3
publicint[] getIndexes(){ :$d 3a"]
return indexes; T,@7giQg@
} 0_izTke
e$I:[>
publicvoid setIndexes(int[] indexes){ -q|M=6gOs
this.indexes = indexes; )+R3C%
} HXo'^^}q;
_fw'c*j
publicint getStartIndex(){ lR^Qm|
return startIndex; x9s`H)
} 13
p0w
xF0*q
publicvoid setStartIndex(int startIndex){ =J\7(0Dz4t
if(totalCount <= 0) u:?RdB}B_@
this.startIndex = 0; ]xs\,}I%
elseif(startIndex >= totalCount) NKYyMHv6
this.startIndex = indexes n&&y\?n
g;@PEZk1
[indexes.length - 1]; ]TN}`]
elseif(startIndex < 0) Q&{5.}L
this.startIndex = 0; uS.a9
Q(
else{ 'iK*#b8l
this.startIndex = indexes :D-vE7
u?/]"4
[startIndex / pageSize]; %&GQ]pmcY
} N`fY%"5U>
} Fd'L:A~
X/"H+l
publicint getNextIndex(){ W0hLh<Go
int nextIndex = getStartIndex() + cH ?]uu(
<3OV
pageSize; |[ofc!/
if(nextIndex >= totalCount) $nWmoe)
return getStartIndex(); =z.AQe+
else 2Ta F7Jn
return nextIndex; =wc[r?7
} Hq8.O/Y"=
:{<HiJdp
publicint getPreviousIndex(){ #xB%v
int previousIndex = getStartIndex() - x$sQ .aT
w"J(sVy4
pageSize; gUQCKNw
if(previousIndex < 0) @^@-A\7[KO
return0; p%'((!a2
else #kEdf0
return previousIndex; -`o:W?V$u
} X_2I4Jz]6
A+&Va\|x
} |R;=P(0it
D1 z3E;:
un=)k;oh
o,I642R~
抽象业务类 A}# Mrb
java代码: -B!pg7>'##
rKxk?}
I&0yUhn
/** |n/id(R+
* Created on 2005-7-12 CJ b~~
*/ cj)~7 WF
package com.javaeye.common.business; t~`Ef
( d.i np(
import java.io.Serializable; >6j`ZWab>
import java.util.List; >LSA?dy!?
52,a5TVG
import org.hibernate.Criteria; DTY=k
import org.hibernate.HibernateException; %iNDRLR%I
import org.hibernate.Session; ;MD{p1w
import org.hibernate.criterion.DetachedCriteria; 3 -FNd~%
import org.hibernate.criterion.Projections; ^4:= b
import usip>y
WMg^W(
org.springframework.orm.hibernate3.HibernateCallback; Sl#XJ0 g
import <rI~+J]s
# L R[6l
org.springframework.orm.hibernate3.support.HibernateDaoS ;.Y`T/eWS
tuSgh!
upport; `,O^=HBM
xM,3F jF
import com.javaeye.common.util.PaginationSupport; +TX]~k79Oq
=&'j;j
public abstract class AbstractManager extends WUWQcJj
KN=Orx7Gy
HibernateDaoSupport { }e$);A|
F=H=[pSe
privateboolean cacheQueries = false; '*:YC
.O(UK4Mb
privateString queryCacheRegion; d8>D=Ve
rv%Xvs B
publicvoid setCacheQueries(boolean DzEixE-
g;pymz
cacheQueries){ w pvaTHo
this.cacheQueries = cacheQueries; |bh:x{h
} -e ya$C
4^5s\f B
publicvoid setQueryCacheRegion(String UJI1n?~
RK0IkRXQd
queryCacheRegion){ 6lPGop]js]
this.queryCacheRegion = @`yfft
C-7.Sa
queryCacheRegion; `i-&Z`
} +qdK]RR}
j:#[voo7
publicvoid save(finalObject entity){ q$K~BgFzpZ
getHibernateTemplate().save(entity); |v+b?@
} > jcNo3S
=uH`EkY:
publicvoid persist(finalObject entity){ bCsQWsj^NW
getHibernateTemplate().save(entity); s`{O-
} |@+
x9|'W
:;EzvRy
publicvoid update(finalObject entity){ Nuj%8om6
getHibernateTemplate().update(entity); J_,y?}.e3
} 8K qv)FjB
VybiuP
publicvoid delete(finalObject entity){ @ 9uwcM1F
getHibernateTemplate().delete(entity); 8PQ& 7o
} 83h6>D b
"^\ 4xI
publicObject load(finalClass entity, D 6(w}W
~b+>o
finalSerializable id){ ~_q\?pw<$L
return getHibernateTemplate().load {5*5tCIt
n\QG-?%Pi
(entity, id); 5ZPl`[He
} )wC>Hq[mhW
Y9C] -zEv
publicObject get(finalClass entity, zr,jaR;
Cpr}*A
finalSerializable id){ 61]6N;kJ;
return getHibernateTemplate().get Wrlmo'31
3wK)vW
(entity, id); X,p&S^
} w/R^Vwq
2c}kiqi{
publicList findAll(finalClass entity){ #M:W?&.
return getHibernateTemplate().find("from c;Li~FLR
5d)G30
" + entity.getName()); K3jno+U&
} =I?p(MqW
L%"&_v#a^
publicList findByNamedQuery(finalString ?p5Eo{B
)2a!EEHz
namedQuery){ 7BC9cS(0w9
return getHibernateTemplate i"-j:b:c<
\"5 \hX~dS
().findByNamedQuery(namedQuery); Yz,*Q<t
} *yB!^O
A2B&X}K|U
publicList findByNamedQuery(finalString query, 8!1o,=I$
% R'eV<
finalObject parameter){ 2 `#|;x^<
return getHibernateTemplate %j=7e@
_onHe"%{
().findByNamedQuery(query, parameter); ALFw[1X
} sg3%n0Ms.W
k07O.9>
publicList findByNamedQuery(finalString query, S>6APQ-
xH92=t-w
finalObject[] parameters){ @x)z" )>
return getHibernateTemplate :`_wy-}V
mCg 5-E~;
().findByNamedQuery(query, parameters); '0[l'Dt'
} |/q *Fg[f
L)Kn8
publicList find(finalString query){ a+MC[aFr
return getHibernateTemplate().find TiH(HW|:
L,R9jMx?_
(query); LG;xZQx'
} p{.EFa>H
FC(m)S2
publicList find(finalString query, finalObject RVD=CX
&4]%&mX)-
parameter){ fz:F*zT1
return getHibernateTemplate().find P afmHXx
wTOB'
(query, parameter); \"n&|_SZ\
} 2(UT;PSI
0\.y0
K8
public PaginationSupport findPageByCriteria "3Ec0U \s
n] &fod
(final DetachedCriteria detachedCriteria){ m(9E{;
return findPageByCriteria L-Z1Xs
1y>P<[
(detachedCriteria, PaginationSupport.PAGESIZE, 0); ?L|@{RS{|
} 7^S &g.A
H>M0GL
public PaginationSupport findPageByCriteria >b/Yg:t
!]W6i]p
(final DetachedCriteria detachedCriteria, finalint Hd4&"oeY
55hJRm3
startIndex){ jLZ+HYyG9
return findPageByCriteria U,)+wZJ
Dtn|$g,
(detachedCriteria, PaginationSupport.PAGESIZE, Q7i^VN
!DLIIKO78
startIndex); n`CmbM@@
} D`Fl*Wc4H
w)hJ0k
public PaginationSupport findPageByCriteria j'~xe3j
~?nPp$^
(final DetachedCriteria detachedCriteria, finalint P[^!Uq[0n7
N@*v'MEko%
pageSize, SdN|-'qf
finalint startIndex){ x_#yH3kJ
return(PaginationSupport) >&p_G0-
#t9&X8:U
getHibernateTemplate().execute(new HibernateCallback(){ qxk1Rzm?x
publicObject doInHibernate $vicxE~-E
O(CUwk
(Session session)throws HibernateException { 0^zu T
Criteria criteria = bD=_44I
QRx'BY$5
detachedCriteria.getExecutableCriteria(session); I/fERnHM/+
int totalCount = <` HLG2
'j>Q7M7q{
((Integer) criteria.setProjection(Projections.rowCount )0!hw|0|
%$S.4#G2
()).uniqueResult()).intValue(); i |cSO2O+
criteria.setProjection XYf;72*
9].!mpR
(null); I 8e{%PK
List items = <^OGJ}G
n&k1'KL&
criteria.setFirstResult(startIndex).setMaxResults |7%M:7Q
`[[
A7
(pageSize).list(); 3]/w3|y
PaginationSupport ps = zPZy#7/A
?2QssfB
new PaginationSupport(items, totalCount, pageSize, J/WPffqD
vA"yy"B+ V
startIndex); dfO84Z}
5
return ps; iw<+rh*C
} J$@3,=L6V
}, true); -&%#R_RV
} {'EQ%H$q
0t'WM=W<!8
public List findAllByCriteria(final N(6|TE2
H"].G^V\6
DetachedCriteria detachedCriteria){ kznmA`#jn
return(List) getHibernateTemplate p e |k}{
rWAJL9M
().execute(new HibernateCallback(){ ,"5Fw4G6*
publicObject doInHibernate =l?5!f9
2Q0fgH2
(Session session)throws HibernateException { [iB`- dE,
Criteria criteria = 67%o83\
m'@NF--#Oq
detachedCriteria.getExecutableCriteria(session);
:p5V5iG
return criteria.list(); PG+ICg
} nu|;(ly
}, true); %Gh!h4Pv
} @'jC>BS8`
!Zlvz%X
public int getCountByCriteria(final ;y
Wfb|!
){ArZjG>
DetachedCriteria detachedCriteria){ Q3'\Vj,S&
Integer count = (Integer) 0Evq</
c5nl!0XX
getHibernateTemplate().execute(new HibernateCallback(){ eBlVb*nmq
publicObject doInHibernate CZuV{Oh}?
vrLI`3n]
(Session session)throws HibernateException { 1s"6
Criteria criteria = &FW|O(]
*C}vy`X
detachedCriteria.getExecutableCriteria(session); 1-Sc@WXd
return T\NvN&h-
h,LwC9
criteria.setProjection(Projections.rowCount ix [aS
DgGGrV`
()).uniqueResult(); now\-XrS
} 3mIVNT@S9
}, true); T&j_7Q\;vI
return count.intValue(); "at*G>+
} %nSLe~b
} 7&DhEI ^
&>XIK8*
eZ8~t/8
^~E?7{BL
!/[/w39D0o
#"jEc*&=
用户在web层构造查询条件detachedCriteria,和可选的 ckHHD|
h}nceH0s3d
startIndex,调用业务bean的相应findByCriteria方法,返回一个 mhv{6v
2zZ" }Zr#
PaginationSupport的实例ps。 @rB!47!
Hw-,sze j"
ps.getItems()得到已分页好的结果集 |W[BqQIf
ps.getIndexes()得到分页索引的数组 f,wB.MN
ps.getTotalCount()得到总结果数 \'q 9,tP
ps.getStartIndex()当前分页索引 "u@)
ps.getNextIndex()下一页索引 82O#Fe q
ps.getPreviousIndex()上一页索引 0B7cpw>_J
.BuXg<`
pdUrVmW "'
FZ)_WaqGf
0O5(\8jM
sG!SSRL@
K&0'@#bE\
连续看了两篇robbin有关DetachedCriteria的介绍,感觉真的不错 JPltB8j?
HTA@en[5
,尤其是上面的示例代码,让我着实觉得该对我原来的分页查询做 7^>UUdk(
Vcm9:,Xlw
一下代码重构了。 87.b7 b.
~G+o;N,V
我把原本我的做法也提供出来供大家讨论吧: vN=e1\
6p|*H?|It
首先,为了实现分页查询,我封装了一个Page类: T:p,!?kc7
java代码: .KSPr
Z/n\Ak sE
7O84R^!|2
/*Created on 2005-4-14*/ Q ;V `
package org.flyware.util.page; Dl_y[9
Y]!8Ymuww@
/** -!zyit5B
* @author Joa e@}zp
* !#wd~: H
*/ yqi=9NB
publicclass Page { o&g-0!"
~"6/OJA
/** imply if the page has previous page */ \3a(8Em
privateboolean hasPrePage; 'mx_]b^O
U{6i5;F#H
/** imply if the page has next page */ aZ"9)RJe
privateboolean hasNextPage; 1iyd{r7|
F0
x5(lpQ
/** the number of every page */ ?nN3K
privateint everyPage; $Hh3*reSg-
_?$P?
/** the total page number */
Q}.zE+
privateint totalPage; f4eLnY
gBBS}HF
/** the number of current page */ cyu)YxT
privateint currentPage; Z:7X=t=
YaI8hj@}
/** the begin index of the records by the current Ry2rQM`
#!!Ea'3Iq
query */ 7UM!<@9\
privateint beginIndex; WtlPgT;wE
;[9WB<t
l8rBp87Q
/** The default constructor */ 'Pyeb`AXE9
public Page(){ X-[_g!pV
U,q
]
} H~y 7o_tg
lW}"6@0,
/** construct the page by everyPage ^wDZg`
* @param everyPage $w!; ~s
* */ <7Igd6u
public Page(int everyPage){ 5[NF
this.everyPage = everyPage; N]qX^RSb
} $42%H#
CtItzp
/** The whole constructor */ svki=GD_(.
public Page(boolean hasPrePage, boolean hasNextPage, a:nMW '!
Q(Uj5 aX
BfQRw>dZ"{
int everyPage, int totalPage, ~&)
int currentPage, int beginIndex){ :{2exu
this.hasPrePage = hasPrePage; bj)dYjf
this.hasNextPage = hasNextPage; tS!|#h-J
this.everyPage = everyPage; m E<n=g=
this.totalPage = totalPage; m<]b]FQ
this.currentPage = currentPage; ^}nz^+R
this.beginIndex = beginIndex; ra#s!m1
} % heX06
[;O 6)W
/** Ji%6/zV
* @return 'uAH, .B
* Returns the beginIndex. @k.j6LKbc
*/ GMD>Ih.k:9
publicint getBeginIndex(){ gHCk;dmq81
return beginIndex; oB$7m4xO\
} nU]4)t_o\
=FZt
/** eq>E<X#<
* @param beginIndex r[2N;U
* The beginIndex to set. GWP;;x%
*/ X2ShxD|
publicvoid setBeginIndex(int beginIndex){ 7|=*z
this.beginIndex = beginIndex; JUBihw4
} i^hgs`hvU
eO<:X|9T
/** Ya$JX(aUe
* @return ;Kb]v\C:
* Returns the currentPage. l+$e|F
*/ $'M:H_T
publicint getCurrentPage(){ .^]=h#[e
return currentPage; >C|/%$kk:f
} WHh=hts\
"f'pa&oHi
/** bvM\Qzc!<3
* @param currentPage |UbwPL_L
* The currentPage to set. xxnMvL;
*/ $O|J8; "v
publicvoid setCurrentPage(int currentPage){ Rxe
sK
this.currentPage = currentPage; 6.fahg?E
} +{* @36A5A
Q=hf,/N
/** Mq7d*Bgb
* @return [;5?=X,LD
* Returns the everyPage. e[D'0L
*/ y7 tK>aD}
publicint getEveryPage(){ O{"
A3f
return everyPage; {eR,a-D!7
} d9/YW#tm
Y)%CxaO`
/** [[fhfV+H
* @param everyPage K<`"Sr
* The everyPage to set. |Tz/9t
*/ >icK]W
publicvoid setEveryPage(int everyPage){ G~Oj}rn
this.everyPage = everyPage; v&:R{
} ,~@0IKIA
Q
lqC
a%V
/** c"mRMDg%
* @return z`b.~<P
* Returns the hasNextPage. 2+G_Y>
*/ Vab+58s5
publicboolean getHasNextPage(){ <fY<.X
return hasNextPage; %dXf C!
} ~O{sOl
_<4
=d_@k[8<0
/** $ohg?B;
* @param hasNextPage VN=S&iBa/
* The hasNextPage to set. WZ"g:Khw
*/ aOYRenqu
publicvoid setHasNextPage(boolean hasNextPage){ VK9I#
this.hasNextPage = hasNextPage; E|2klA^+*
} l\l\T<wa,
*GsrG*OM*D
/** XK:KWqW
* @return xe)< )y
* Returns the hasPrePage. wzAp`Zs2Dm
*/ 7S<Z&1(
publicboolean getHasPrePage(){ ?3tR(H<
return hasPrePage; A/NwM1z[o)
} "yMr\jt~-
6"Tr$E
/** p-U'5<n
* @param hasPrePage Xg#g`m%(M
* The hasPrePage to set. ~mUP!f
*/ |L{<=NNs:D
publicvoid setHasPrePage(boolean hasPrePage){ GXaCH))TO
this.hasPrePage = hasPrePage; B^(0>Da\
} D]+tr%
Py(l+Ik`>
/** ;D_6u(IC4:
* @return Returns the totalPage. m{gK<T
* 8a{FxCBw
*/ O2{_:B>K[
publicint getTotalPage(){ x9PEYhL?
return totalPage; !F{ 5"$
} * wN+Ak q
UP:+1Sp9
/** &libC>a[
* @param totalPage x@bZ((w
* The totalPage to set. WU1I>i
*/ F'ZLN]"{
publicvoid setTotalPage(int totalPage){ .ao'o,|vE
this.totalPage = totalPage; 5v8&C2Jy@
} Ch
` Omq
(mHFyEG
} m,e1:Nk<
<wTkPErUG
qv3L@"Ub
rS9*_-NH
M3 8,SH<
上面的这个Page类对象只是一个完整的Page描述,接下来我写了一 n15c1=gs
&Qghm o
个PageUtil,负责对Page对象进行构造: ))63?_
java代码: %@(6,^3%i
$Vp&Vc8
r2QC$V:0
/*Created on 2005-4-14*/ <u44YvLBm
package org.flyware.util.page; C78d29
^sH1YE}0
import org.apache.commons.logging.Log; ;D]TPBE
import org.apache.commons.logging.LogFactory; (J Fa
+7+
VbsFG
/** "/hs@4{u9
* @author Joa dQA J`9B
* t]FFGnBZ
*/ +u_mT$|T
publicclass PageUtil { URR|Q!D
,=>O/!s
privatestaticfinal Log logger = LogFactory.getLog `(.ue8T
=fBJQK2sk
(PageUtil.class); @6.1EK0
)@Xdr0
/** 7 pg8kq@
* Use the origin page to create a new page Uy ;oJY
* @param page ]@ETQ8QN
* @param totalRecords `Pl=%DR
* @return `Y.RAw5LrE
*/ J#@" Yb
publicstatic Page createPage(Page page, int "DWw1{ 5/
oB3>0Pm*a.
totalRecords){ 2ok>z$Y
return createPage(page.getEveryPage(), ..;LU:F
(B]Vw+/
page.getCurrentPage(), totalRecords); l%B1JGu*F
} %8
cFzyE*
_a*Wk
/** hUGIy(
* the basic page utils not including exception ~2A<fL,-
sut j
G`m
handler snj4MA@I]
* @param everyPage zGZe|-
* @param currentPage S%&l(=0X
* @param totalRecords O0b8wpFf
* @return page 9>@_};l
*/ lW&glU(
publicstatic Page createPage(int everyPage, int p fAp2"
8qBRO[
currentPage, int totalRecords){ ]RnX'yw^
everyPage = getEveryPage(everyPage); */\dH<
currentPage = getCurrentPage(currentPage); RWA|%/L
int beginIndex = getBeginIndex(everyPage, {LJCY<IGq
oF
V9t{~j
currentPage); [W{`L_"
int totalPage = getTotalPage(everyPage, x+yt|
&B
Q'~;RE%T
totalRecords); "@`mPe/
boolean hasNextPage = hasNextPage(currentPage, ,\}V.:THF
;5y4v
totalPage); "cJ5Fd:*
boolean hasPrePage = hasPrePage(currentPage); Vzbl*Zmx
`p1`Sxz?
returnnew Page(hasPrePage, hasNextPage, J+DuQ;k;
everyPage, totalPage, LZ&CGV"Z-
currentPage, #3u8BLy$Q
=K8`[iH
beginIndex); Q1eiU Y6
} |7%$+g
Y!&dj95y
privatestaticint getEveryPage(int everyPage){ >47,Hq:2
return everyPage == 0 ? 10 : everyPage; uX}M0W
} by6E
"7%
`5 e#9@/e
privatestaticint getCurrentPage(int currentPage){ NqqLRgMOR'
return currentPage == 0 ? 1 : currentPage; z8z U3?
} wm2Q(l*HH
(nda!^f_s
privatestaticint getBeginIndex(int everyPage, int jIdhmd* $z
,PN>,hFL
currentPage){ ={maCYlE.
return(currentPage - 1) * everyPage; =Z-.4\ 3
} i-E&Y*\^9H
)J#@L*
privatestaticint getTotalPage(int everyPage, int s?%1/&.~
YVW!u6W'[6
totalRecords){ T/S-}|fhQ
int totalPage = 0; ,u]kZ ]
J_P2% b=C
if(totalRecords % everyPage == 0) 4TR:bQZs
totalPage = totalRecords / everyPage; 6dq U4
else )sNtwSl^
totalPage = totalRecords / everyPage + 1 ; 3wR5:O$H
hDp'=}85@
return totalPage; ;oR-\;]/.
} 5&