Java Web page sharing and Java Web page sharing

Source: Internet
Author: User

Java Web page sharing and Java Web page sharing

Share by page:

Package com. hcj. util; import java. util. arrayList; import java. util. list; import org. apache. struts2.json. annotations. JSON; // public class Page of the paging class <E> {private int totals; // The total number of queried private lists <E> bigList; // total record set private List <E> smallList; // when the page displays the record set private int currentPage = 1; // the current page private int pages; // total number of pages private int pageSize = 8; // number of records per page private int privious; // Previous Page private int next; // next page private B Oolean firstPage = false; // private boolean lastPage = false on the first page; // public int getTotals () {return totals;} public void setTotals (int totals) {this. totals = totals;} @ JSON (serialize = false) public List <E> getBigList () {return bigList;} public void setBigList (List <E> bigList) {this. bigList = bigList;} public List <E> getSmallList () {this. smallList = new ArrayList <E> (); for (int I = (currentPage-1) * PageSize; (I <currentPage * pageSize) & (I <totals); I ++) {smallList. add (bigList. get (I);} return smallList;} public void setSmallList (List <E> smallList) {this. smallList = smallList;} public int getCurrentPage () {return currentPage;} public void setCurrentPage (int currentPage) {this. currentPage = currentPage;} public int getPages () {if (totals % pageSize = 0) {pages = totals/pageSize;} else {Pages = totals/pageSize + 1;} return pages;} public void setPages (int pages) {this. pages = pages;} public int getPageSize () {return pageSize;} public void setPageSize (int pageSize) {this. pageSize = pageSize;} public int getPrivious () {if (currentPage! = 1) {privious = currentPage-1;} else {privious = 1;} return privious;} public void setPrivious (int privious) {this. privious = privious;} public int getNext () {if (currentPage! = GetPages () {next = currentPage + 1;} else {next = currentPage;} return next;} public void setNext (int next) {this. next = next;} public boolean isFirstPage () {if (currentPage = 1) {firstPage = true;} return firstPage;} public void setFirstPage (boolean firstPage) {this. firstPage = firstPage;} public boolean isLastPage () {if (currentPage = getPages () {lastPage = true;} return lastPage;} public void setLastPage (boolean lastPage) {this. lastPage = lastPage;} public Page () {super (); // TODO Auto-generated constructor stub} // enter the summary result, current Page and size per Page (8 pages by default) public Page (List <E> bigList, int currentPage, int pageSize) {super (); this. bigList = bigList; this. currentPage = currentPage; this. pageSize = pageSize; // set total. this step is very important. setTotals (bigList. size ();} public Page (List <E> bigList, int currentPage) {super (); this. bigList = bigList; this. currentPage = currentPage; this. setTotals (bigList. size ());}}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.