如下所示:
package ssmy.page;/*** 分页类* @author Jesse**/public class PageBean {private int page;//第几页private int pageSize;//每页显示的记录数private int start ;//起始记录数public int getPage() {return page;}public void setPage(int page) {this.page = page;}public int getPageSize() {return pageSize;}public void setPageSize(int pageSize) {this.pageSize = pageSize;}public int getStart() {return (page-1)*pageSize;}public void setStart(int start) {this.start = start;}public PageBean(int page, int pageSize) {super();this.page = page;this.pageSize = pageSize;}}
package ssmy.page;import java.io.PrintWriter;import javax.servlet.http.HttpServletResponse;public class ResponseUtil {public static void write(HttpServletResponse response,Object o)throws Exception{response.setContentType("text/html;charset=utf-8");PrintWriter out=response.getWriter();out.println(o.toString());out.flush();out.close();}}
package ssmy.page;/*** 字符串工具类* @author **/public class StringUtil {/*** 判断是否是空* @param str* @return*/public static boolean isEmpty(String str){if(str==null||"".equals(str.trim())){return true;}else{return false;}}/*** 判断是否不是空* @param str* @return*/public static boolean isNotEmpty(String str){if((str!=null)&&!"".equals(str.trim())){return true;}else{return false;}}/*** 格式化模糊查询* @param str* @return*/public static String formatLike(String str){if(isNotEmpty(str)){return "%"+str+"%";}else{return null;}}}
以上这篇浅谈java分页三个类 PageBean ResponseUtil StringUtil就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持VeVb武林网。
新闻热点
疑难解答
图片精选