public String gettext(HttpServletRequest request,HttpServletResponse response){
List<xuanhuan_> xuanhuan = service.getxuanhuan();
JSONArray json = JSONArray.fromObject(xuanhuan);
System.out.println(json);//在这里可以看到,json类型可以直接打印出来
return "/index";
}

打印结果:

[{"content":"","id":0,"name":"《测试》1","shijian":null},{"content":"","id":0,"name":"《测试》2","shijian":null},{"content":"","id":0,"name":"《测试》3","shijian":null},{"content":"","id":0,"name":"《测试》4","shijian":null},{"content":"","id":0,"name":"《测试》5","shijian":null},null,null,null]

下载是maven引入json的包:

        <!-- json的包,不是项目自带的 -->

        <dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>

最新文章

  1. CPU acceleration status: HAXM is not installed on this machine解决方法
  2. Python之路----------time模块
  3. android ImageView组件属性
  4. TYVJ 1074 武士风度的牛
  5. 线程变量(ThreadLocal)的使用和测试
  6. DWZ的选择带回功能无法带回第一个value中的值
  7. dump java
  8. mobilize扁平化的fullPage.js类工具使用心得
  9. 初识Selenium(三)
  10. Chapter 3. Video Coding Concepts
  11. web前端vertical-align的作用及对象详解
  12. SPATRA的使用
  13. Spring学习笔记5——注解方式AOP
  14. 如何运行一个Vue项目
  15. mysql两条sql合并查询总数
  16. Codeforces Round #426 (Div. 2) A,B,C
  17. &lt;------------------字节流---------------------&gt;
  18. Go 协程编程感悟
  19. Codeforces Round #427 (Div. 2) D dp
  20. python下使用tesserocr遇到的一些坑

热门文章

  1. c语言argc argv
  2. (1)WPF概述
  3. c++ —— .bat 对拍
  4. SQL Server判断某个字段是否包含中文/英文字符/数字
  5. MessageFormat.format 字符串的模板替换
  6. 本地缓存localstorage使用
  7. kubernetes1.5.2--部署dashboard服务
  8. django admin后台编辑页面 显示数据公式
  9. python项目构建工具zc.buildout
  10. PHP empty()函数说明---用了N遍了就是记不住