Пример #1
0
 /** 跨域操作时返回 */
 public static Object returnObject(PageData pd, Map<String, Object> map) {
   if (pd.containsKey("callback")) {
     String callback = pd.get("callback").toString();
     return new JSONPObject(callback, map);
   } else {
     return map;
   }
 }
Пример #2
0
  /** 设置分页参数 */
  public static PageData setPageParam(PageData pd) {
    String page_now_str = pd.get("page_now").toString();
    int pageNowInt = Integer.parseInt(page_now_str) - 1;
    String page_size_str = pd.get("page_size").toString(); // 每页显示记录数
    int pageSizeInt = Integer.parseInt(page_size_str);

    String page_now = pageNowInt + "";
    String page_start = (pageNowInt * pageSizeInt) + "";

    pd.put("page_now", page_now);
    pd.put("page_start", page_start);

    return pd;
  }