/** * ajax gets * * @return * @throws IOException * @throws JSONException */ public String gets() throws IOException { String jsonString = ""; List<Prop_> list = null; switch (type) { case 1: list = propInfoService.gets(player); break; case 2: list = propInfoService.gets(nickname); break; default: return NONE; } jsonString = JSONtool.serialize(list); response.setContentType("text/xml;charset=utf-8"); response.setHeader("Cache-Control", "no-cache"); PrintWriter out = response.getWriter(); out.append(jsonString); out.close(); return NONE; }
public String edit() throws IOException, JSONException { int code = 0; code = propInfoService.edit(nickname, id, location, area, amount, kind); switch (code) { case 0: message = "未做修改"; break; case 1: message = "修改成功"; break; case 2: message = "昵称为空"; break; case 3: message = "道具ID为空"; break; case 4: message = "区域中的位置为空"; break; case 5: message = "区域为空"; break; case 6: message = "玩家无此道具"; break; default: message = "修改失败,错误码" + code; break; } response.setContentType("text/html;charset=utf-8"); response.setHeader("Cache-Control", "no-cache"); PrintWriter out = response.getWriter(); out.append(message); out.close(); return NONE; }