集合_switch_json
来源:互联网 发布:java数组元素相加 编辑:程序博客网 时间:2024/04/29 18:02
package itHeiMaTestz2;
/*
* 需要的json转换包:fastjson-1.1.34.android.jar
* *
*/
import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
public class GsonZHU {
public static void main(String[] args) {
List list = new ArrayList<String>();
String json = JSONObject.toJSONString(list);//将list集合转为json
//发送
/*
* 就用ServletActionContext获取在struts环境中
* protected PrintWriter getOut()
{
HttpServletResponse response = ServletActionContext.getResponse();
try {
return response.getWriter();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
然后:
PrintWriter getOut = getOut();
getOut.print(json);//这样通过action就发送前端了
* */
}
}
/*
* 需要的json转换包:fastjson-1.1.34.android.jar
* *
*/
import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
public class GsonZHU {
public static void main(String[] args) {
List list = new ArrayList<String>();
String json = JSONObject.toJSONString(list);//将list集合转为json
//发送
/*
* 就用ServletActionContext获取在struts环境中
* protected PrintWriter getOut()
{
HttpServletResponse response = ServletActionContext.getResponse();
try {
return response.getWriter();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
然后:
PrintWriter getOut = getOut();
getOut.print(json);//这样通过action就发送前端了
* */
}
}
0 0
- 集合_switch_json
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 集合
- 正则以空格,回车分割字符串为字符串数组
- jQuery EasyUI datagrid本地分页
- 【2014 Multi-University Training Contest 3】 The Great Pan
- C语言指针总结
- 调整数组顺序使奇数位于偶数前面。
- 集合_switch_json
- SequoiaDB-编目分区组和数据分区组
- [leetcode] Subsets
- MVC 3 Uploadify HTTP 302 error
- BUPT Summer Journey #test7 C
- poj 2182 Lost Cows(线段树经典题)
- 高精度模板
- Namespace declaration statement has to be the very first statement in the script
- [leetcode] Subsets II