zoukankan      html  css  js  c++  java
  • jsp JSON 简单使用

    把jsp程序中信息输出到页面并解析!本例为ajax访问
    
    /**********Java类***************/
    import net.sf.json.JSONObject;
    
    JSONObject beanJSON = new JSONObject();
    
    beanJSON.put("user", "张三");
    beanJSON.put("time", "2000-1-1");
    beanJSON.put("content", "hello word!");
    
    response.getWriter().print(beanJSON); // 输出
    
    /**********页面js部分***************/
    var tt=eval("(" + resultText + ")"); //resultText 为ajax返回值,
    alert(tt.user);
    alert(tt.time);
    alert(tt.content);
    
  • 相关阅读:
    Fish
    Brackets
    StoneWall【★★★★★】
    Nesting
    ajax补充FormData
    初始Ajax
    extra过滤
    Django 之缓存
    django中的信号
    Form组件归类
  • 原文地址:https://www.cnblogs.com/live365wang/p/1996376.html
Copyright © 2011-2022 走看看