/**biz,bizImpl略*//**查询的实体类*/package entity;publicclassDemo2 {privateint recordId;private String date;privateint publishId;private String publishName;private String title;private String author;/*** @return the recordId*/publicintgetRecordId() {return recordId;}/*** @param recordId the recordId to set*/publicvoidsetRecordId(int recordId) {this.recordId = recordId;}/*** @return the date*/public String getDate() {return date;}/*** @param date the date to set*/publicvoidsetDate(String date) {this.date = date;}/*** @return the publishId*/publicintgetPublishId() {return publishId;}/*** @param publishId the publishId to set*/publicvoidsetPublishId(int publishId) {this.publishId = publishId;}/*** @return the publishName*/public String getPublishName() {return publishName;}/*** @param publishName the publishName to set*/publicvoidsetPublishName(String publishName) {this.publishName = publishName;}/*** @return the title*/public String getTitle() {return title;}/*** @param title the title to set*/publicvoidsetTitle(String title) {this.title = title;}/*** @return the author*/public String getAuthor() {return author;}/*** @param author the author to set*/publicvoidsetAuthor(String author) {this.author = author;}}
/**封装的实体类*/package entity;import java.util.List;publicclassPage {private Long page;private Long nextPage;private Long backPage;private Long pageCount;private List<Demo2> demoList;/*** @return the page*/public Long getPage() {return page;}/*** @param page the page to set*/publicvoidsetPage(Long page) {this.page = page;}/*** @return the nextPage*/public Long getNextPage() {return nextPage;}/*** @param nextPage the nextPage to set*/publicvoidsetNextPage(Long nextPage) {this.nextPage = nextPage;}/*** @return the backPage*/public Long getBackPage() {return backPage;}/*** @param backPage the backPage to set*/publicvoidsetBackPage(Long backPage) {this.backPage = backPage;}/*** @return the pageCount*/public Long getPageCount() {return pageCount;}/*** @param pageCount the pageCount to set*/publicvoidsetPageCount(Long pageCount) {this.pageCount = pageCount;}/*** @return the demoList*/public List<Demo2> getDemoList() {return demoList;}/*** @param demoList the demoList to set*/publicvoidsetDemoList(List<Demo2> demoList) {this.demoList = demoList;}}
/**action层*/package action;import java.util.List;import com.opensymphony.xwork2.ActionSupport;import biz.PageBiz;
import entity.Demo2;
import entity.Page;publicclassFenyeActionextendsActionSupport{private PageBiz pageBiz;private Page pageL=new Page();private Demo2 demo2=new Demo2();Long i=(long) 1;public String fenye() {if(pageL.getPage()==null){pageL.setPage(i);}pageL.setBackPage(pageL.getPage()-1);pageL.setNextPage(pageL.getPage()+1);pageL.setPageCount(pageBiz.getPages("Demo2", false, demo2));if(pageL.getBackPage()<1){pageL.setBackPage(i);}if(pageL.getNextPage()>pageL.getPageCount()){pageL.setNextPage(pageL.getPageCount());}pageL.setDemoList(pageBiz.fenye("Demo2", demo2, false, pageL.getPage()));return"fenye";}/*** @return the pageBiz*/public PageBiz getPageBiz() {return pageBiz;}/*** @param pageBiz the pageBiz to set*/publicvoidsetPageBiz(PageBiz pageBiz) {this.pageBiz = pageBiz;}/*** @return the pageL*/public Page getPageL() {return pageL;}/*** @param pageL the pageL to set*/publicvoidsetPageL(Page pageL) {this.pageL = pageL;}/*** @return the demo2*/public Demo2 getDemo2() {return demo2;}/*** @param demo2 the demo2 to set*/publicvoidsetDemo2(Demo2 demo2) {this.demo2 = demo2;}}
/**JSP页面*/
/**fp.jsp*/
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>Insert title here</title></head><body><ahref="fenyeAction.action">点击</a></body></html>