package ssmy.page; /** * 分頁類 * @author Jesse * */public class PageBean { private int page;//第幾頁 private int pageSize;//每頁顯示的記錄數 private int start ;//起 ...
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;
}
}
}