data.jsp 3.62 KB
<%@page import="net.sf.json.JSONArray"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="weaver.general.Util"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/mobilemode/mobile/base.jsp"%>
<%
int pageNo = Util.getIntValue(request.getParameter("pageNo"), 1);
int pageSize = Util.getIntValue(request.getParameter("pageSize"), 10);
JSONObject json = JSONObject.fromObject("{'totalSize':'10', 'datas':[]}");
List<JSONObject> datas = new ArrayList<JSONObject>();
datas.add(JSONObject.fromObject("{'id':'1','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'热烈欢迎朱锟加入EBU技术中心','content':'2015梦想羊帆起航,EBU携手SME共创未来…', 'cat':'人事新闻', 'date':'2017-08-09','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'2','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'2012年6月份泛微销售业绩排行榜','content':'EBU携手SME共创未来…', 'cat':'公司新闻', 'date':'2017-07-09','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'3','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'热烈欢迎靳志远加入SME事业本部','content':'2015梦想羊帆起航,EBU携手SME共创未来…', 'cat':'综合新闻', 'date':'2017-06-09','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'4','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'2012年3月份泛微销售业绩排行榜','content':'', 'cat':'人事新闻', 'date':'2017-08-09','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'5','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'泛微OA签约上海电驱动股份有限公司','content':'梦想羊帆起航,EBU携手SME共创未来…', 'cat':'技术新闻', 'date':'2017-08-10','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'6','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'2012年4月份泛微销售业绩排行榜','content':'', 'cat':'人事新闻', 'date':'2017-07-22'}"));
datas.add(JSONObject.fromObject("{'id':'7','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'2015年5月产品改进建议奖','content':'最多建议奖:奖金总额500元, 由每个月建议数(未经处理的客户建议不计)最多者获取', 'cat':'人事新闻', 'date':'2017-08-09','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'8','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'测试一下新闻是否能够推送到微信','content':'', 'cat':'人事新闻', 'date':'2016-08-29','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'9','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'测试一下新闻是否能够推送到微信','content':'', 'cat':'人事新闻', 'date':'2017-09-09','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'10','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'测试一下新闻是否能够推送到微信','content':'', 'cat':'人事新闻', 'date':'2017-08-09','tel':'18888888888', 'email':'admin@admin.com'}"));
int startIndex = (pageNo - 1) * pageSize;
int endIndex = startIndex + pageSize;
json.put("datas", JSONArray.fromObject(datas.subList(startIndex, endIndex > 10 ? 10 : endIndex)));;
out.print(json);
%>