/* */ public String search() /* */ { /* 142 */ PagingBean pb = getInitPagingBean(); /* 143 */ String searchContent = getRequest().getParameter("searchContent"); /* 144 */ String isNotice = getRequest().getParameter("isNotice"); /* 145 */ List list = this.newsService.findBySearch(new Short(isNotice), searchContent, pb); /* */ /* 147 */ Type type = new TypeToken() {} /* 147 */.getType(); /* 148 */ StringBuffer buff = new StringBuffer("{success:true,'totalCounts':") /* 149 */ .append(pb.getTotalItems()) .append(",result:"); /* */ /* 151 */ Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); /* 152 */ buff.append(gson.toJson(list, type)); /* 153 */ buff.append("}"); /* */ /* 155 */ this.jsonString = buff.toString(); /* 156 */ return "success"; /* */ }
private String toJson(PagingBean pb, List<Conference> list) { Type type = new TypeToken() {}.getType(); StringBuffer buff = new StringBuffer("{success:true,'totalCounts':") .append(pb.getTotalItems()) .append(",result:"); Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd hh:mm:ss").create(); buff.append(gson.toJson(list, type)); buff.append("}"); setJsonString(buff.toString()); return "success"; }
public String today() { PagingBean pb = new PagingBean(this.start.intValue(), this.limit.intValue()); List<CalendarPlan> list = this.calendarPlanService.getTodayPlans(ContextUtil.getCurrentUserId(), pb); List<PlanInfo> planList = new ArrayList<PlanInfo>(); for (CalendarPlan plan : list) { planList.add(new PlanInfo(plan)); } Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); StringBuffer buff = new StringBuffer("{success:true,'totalCounts':") .append(pb.getTotalItems()) .append(",result:"); Type type = new TypeToken<List<PlanInfo>>() {}.getType(); buff.append(gson.toJson(planList, type)); buff.append("}"); setJsonString(buff.toString()); return "success"; }