import com.google.gson.Gson; google
// 序列和反序列化JSON
Gson gson = new Gson();.net
/**
* 保存用戶排序
*
* @return
* @throws IOException
*/
@Action(value = "save_sort")
public void save_sort() throws IOException {
try {
if (sortStr != null && !sortStr.equals("")) {
List<UserSort> list = gson.fromJson(sortStr,
new TypeToken<List<UserSort>>() {
}.getType());排序
for (UserSort u : list) {
jdbc.update("update pub_user set sort=" + u.getSort()
+ ",status=" + u.getStatus() + " where user_id="
+ u.getUser_id());
}
}
} catch (Exception e) {
e.printStackTrace();
}utf-8
res.setCharacterEncoding("utf-8");
PrintWriter print = res.getWriter();
print.print("true");
print.close();
}get