67,549
社区成员




String data="[{\"judge\":"a"}]";
String content =new String("<h3><font color="blue">这里是数据测试</font></h3><p>sdf </p>");
String data="[{\"judge\":"+content+"}]";
你觉得将上面的data能以json的格式传过去吗?
String content =new String("<h3><font color="blue">这里是数据测试</font></h3><p>sdf </p>");
String data="[{\"judge\":"+content+"}]";
你觉得将上面的data能以json的格式传过去吗?
[/quote]
你要ajax输出给客户端?这样的话你用json-lib就是了
response.setContentType("application/json;charset=utf-8");
PrintWriter pw=response.getWriter();
String content ="<h3><font color=\"blue\">这里是数据测试</font></h3><p>sdf </p>";
JSONObject jo=new JSONObject();
jo.accumulate("judge", content);
JSONArray ja=new JSONArray();
ja.add(jo);
pw.write(ja.toString());
pw.flush();
pw.close();[/quote]但是刚刚发现这么用的话,前台的回调函数无法回调成功啊!
String content =new String("<h3><font color="blue">这里是数据测试</font></h3><p>sdf </p>");
String data="[{\"judge\":"+content+"}]";
你觉得将上面的data能以json的格式传过去吗?
[/quote]
你要ajax输出给客户端?这样的话你用json-lib就是了
response.setContentType("application/json;charset=utf-8");
PrintWriter pw=response.getWriter();
String content ="<h3><font color=\"blue\">这里是数据测试</font></h3><p>sdf </p>";
JSONObject jo=new JSONObject();
jo.accumulate("judge", content);
JSONArray ja=new JSONArray();
ja.add(jo);
pw.write(ja.toString());
pw.flush();
pw.close();[/quote]但是刚刚发现这么用的话,前台的回调函数无法回调成功啊!<h3><font color="blue">这里是数据测试</font></h3>
<p>sdf </p>
这样是通不过的!
String content =new String("<h3><font color="blue">这里是数据测试</font></h3><p>sdf </p>");
String data="[{\"judge\":"+content+"}]";
你觉得将上面的data能以json的格式传过去吗?
[/quote]
你要ajax输出给客户端?这样的话你用json-lib就是了
response.setContentType("application/json;charset=utf-8");
PrintWriter pw=response.getWriter();
String content ="<h3><font color=\"blue\">这里是数据测试</font></h3><p>sdf </p>";
JSONObject jo=new JSONObject();
jo.accumulate("judge", content);
JSONArray ja=new JSONArray();
ja.add(jo);
pw.write(ja.toString());
pw.flush();
pw.close();[/quote]非常霸气,我以前一直想用工具就是不知道工具的使用具体方法,刚刚用了一下,行得通,非常感谢!
String content =new String("<h3><font color="blue">这里是数据测试</font></h3><p>sdf </p>");
String data="[{\"judge\":"+content+"}]";
你觉得将上面的data能以json的格式传过去吗?
[/quote]
你要ajax输出给客户端?这样的话你用json-lib就是了
response.setContentType("application/json;charset=utf-8");
PrintWriter pw=response.getWriter();
String content ="<h3><font color=\"blue\">这里是数据测试</font></h3><p>sdf </p>";
JSONObject jo=new JSONObject();
jo.accumulate("judge", content);
JSONArray ja=new JSONArray();
ja.add(jo);
pw.write(ja.toString());
pw.flush();
pw.close();