public ActionForward gettuanjson(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
//处理城市id
String cityNamePinYin=request.getParameter("city");
if(cityNamePinYin==null||cityNamePinYin.equals(""))cityNamePinYin=Constants.PHONE_DEFAULT_CITY;
City city=cityManager.getCityByCityNamePinYin(cityNamePinYin);
int cid=Constants.PHONE_DEFAULT_CITY_ID;
if(city!=null)cid=city.getId();
//处理目录
Integer category=this.getInt(request, "category", Constants.PHONE_DEFAULT_CATEGORY);
//处理页数
int pageNo = this.getInt(request, "pageno", Constants.PHONE_DEFAULT_PAGENO);
//处理顺序
int order=this.getInt(request, "order", Constants.ORDER_WEIGHT);
List tuanList=tuanManager.getTuanList(cid, category, order,Constants.PHONE_DEFAULT_PAGESIZE,pageNo );
Gson gson = new Gson();
String listToJson = gson.toJson(tuanList);
outPrintText(response,listToJson);
return null;
}
Java输出json
最新推荐文章于 2021-03-12 00:36:25 发布