在UI中使用JSP/JSTL标签显示JSON对象? [英] Display JSON object using JSP/ JSTL tags in UI?

查看:76
本文介绍了在UI中使用JSP/JSTL标签显示JSON对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Java到jsp的json响应的格式如下:

I am getting a json response from java to jsp in the below format:

[
   {
      "title":"JAVA",
      "time":"2hrs"
   },
   {
      "title":"JSP"
   },
   {
      "title":"JSTL"
   },
   {
      "title":"JQUERY"
   }
]

我必须对其进行迭代并在JSP中显示.我不想通过javascript/jquery显示它,因为我的要求要求我使用jsp,jstl显示json对象.请建议我一些解决方案?

This i have to iterate it and show in the JSP. I dont want to display it through javascript / jquery because my requirement demands me to display json object using jsp, jstl. Please suggest me some solution?

推荐答案

您应该使用例如杰克逊(Jackson),然后将数据添加到简单对象.这些应该传递给您的模型,该模型在您的视图中可用.在您的视图中,只需迭代创建的对象即可.

You should parse the JSON input in your controller, with Jackson for example, and add the data to simple objects. These you should pass to your model, which is available in your view. In you view simply iterate the created objects.

这篇关于在UI中使用JSP/JSTL标签显示JSON对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆