net.sf.json使用
来源:互联网 发布:清宫表和49算法哪个准 编辑:程序博客网 时间:2024/06/05 00:26
/** * 将指定Java对象转为json,并响应到客户端页面 * @param o * @param exclueds */public void java2Json(Object o ,String[] exclueds){JsonConfig jsonConfig = new JsonConfig();//指定哪些属性不需要转jsonjsonConfig.setExcludes(exclueds);String json = JSONObject.fromObject(o,jsonConfig).toString();ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");try {ServletActionContext.getResponse().getWriter().print(json);} catch (IOException e) {e.printStackTrace();}}/** * 将指定Java对象转为json,并响应到客户端页面 * @param o * @param exclueds */public void java2Json(List o ,String[] exclueds){JsonConfig jsonConfig = new JsonConfig();//指定哪些属性不需要转jsonjsonConfig.setExcludes(exclueds);String json = JSONArray.fromObject(o,jsonConfig).toString();ServletActionContext.getResponse().setContentType("text/json;charset=utf-8");try {ServletActionContext.getResponse().getWriter().print(json);} catch (IOException e) {e.printStackTrace();}}
阅读全文
0 0
- net.sf.json使用
- net.sf.json的使用
- JSON net.sf.jason使用
- java-JSON net.sf.json使用
- JSON net.sf.json
- JSON net.sf.json
- JSON net.sf.json
- JSON net.sf.json
- JSON net.sf.json
- JSON net.sf.json
- json net.sf.json
- JSON net.sf.json
- android中使用net.sf.json
- net.sf.json.JsonConfig 使用详解
- net.sf.json.JSONException
- java中使用net.sf.json对json进行解析
- java中使用net.sf.json对json进行解析
- java中使用net.sf.json对json进行解析
- 1775: [Usaco2009 Dec]Vidgame 电视游戏问题
- FTPrep, 66 Plus One
- codevs1501 二叉树的最大宽度与深度
- JAVA接口可以实现多继承
- linux iic驱动编程之二 向总线注册设备(2)
- net.sf.json使用
- C#学习指南1(基础篇)
- SpringMVC常用注解
- WorkView符号库剖析
- 【tyvj1356&&1147】腾讯大战360(最短路)&&序列探秘(dp)
- 解决Ubuntu系统无法挂载u盘的问题
- jQuery中的表单提交2
- Java笔记--07
- XlistView多条目加载