For pagination! Online wait! Thank you!

Category: Web Develop
 
dongchengrun
2011-05-04 08:38:55

Sponsored Links
String countSql = "SELECT COUNT (1) FROM aa";
String sqlParam [] [] = new String [0] [0];
java . sql.ResultSet rs = dps.query (countSql, sqlParam, 0);
String nowPage = request.getParameter ("nextPage") ;/ / the currently displayed page
if (nowPage == null) {nowPage = "1";}
int nowPageNum = Integer.parseInt (nowPage);
int pageShowNums = 16 ;/ / number of displayed per page
int allRowNum = 0 ;/ / total number of records
int allPageNum = 0 ;/ / total pages
int modNum = 0 ;/ / last page shows the number of
if (rs.next ()) {
allRowNum = rs.getInt (1);
modNum = allRowNum% pageShowNums;
if (modNum == 0) {
allPageNum = allRowNum / pageShowNums;
} else {
allPageNum = (allRowNum / pageShowNums) +1;
}
System.out.println ("total number of records" + allRowNum + ", total:" + allPageNum + "page");
rs.close ();
} else {
rs.close ();
response.sendRedirect ("/ common / error.jsp? errorMsg = 1 Total number of records fetch failed! '");
}

int startPos = (nowPageNum-1) * pageShowNums +1;
int endPos = 0;
if (nowPageNum == allPageNum) {
endPos = allRowNum;
} else {
endPos = (nowPageNum) * pageShowNums;
}
System.out.println ("Current Item" + nowPage + "page from the" + startPos + "to" + endPos + "bar" );
System.out.println (sql);
rs = dps.query (sql, sqlParam, 0);
Why all the data every time the page is displayed, but the background printing out: Total number of records 127, Total: 8
Showing page 1 from 1-16

Sponsored Links

t4568267
2011-05-04 08:55:43
LZ in the paging do?? online to find examples to make reference to under the bar ...
sqlserver paging SQL (page: this page, pagesize: length):


select top pagesize * from aa
where id not in (select top (page-1)*pagesize id from aa)

:SELECT COUNT(*) FROM aa 
lcyzhumeimeilcy
2011-05-04 09:07:44
. . . Total does not find out how to do pagination?
I have a blog, paging, finishing off his confirmation can be used. Landlord who are interested can look. .
dustblue
2011-05-04 09:23:22

your SQL wrong
should be no argument on behalf of paged data into SQL.
there I did not find your SQL in that. . .
miaochengyang
2011-05-04 09:58:37
because you are so write ah.
SELECT COUNT (1) FROM aa
Is not that all checked out yet
qnm126
2011-05-04 10:37:50
SQL where the definition and assignment of ah did not find
My Eyes degrees too high?
sjm52
2011-05-04 11:16:42
sql wrong
bu417388454
2011-05-04 11:39:26
SELECT COUNT (1) FROM aa ----> SELECT COUNT (*) FROM aa
cnmmdp
2011-05-05 12:17:29
Yes ah! Check out all good paging ah! You have to check out how incomplete know how much data, it will divide many good page?
libeihanzhu
2011-05-05 12:46:32
I want to know what I do wrong? I do not understand the third floor to say!
cxwd123
2011-05-05 01:19:49

how changed sql? ? Why failure to take out of it?
nadir
2011-05-05 01:48:10

or wrong
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.