Skip to content Skip to sidebar Skip to footer

Display JSON Data In Jsp And Html Respectively

I'm a newbie to Java. My test.json file is an array that starts in the following format: { 'Result': 'OK', 'TotalRecordCount': 23, 'Records': [{ 'vEmail': 'blab

Solution 1:

 <html>
 <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
 <script>
  $(function() {
  var people = [];
   $.getJSON('test.json', function(data) {
     $.each(data.records, function(i, f) {
       var tblRow = "<tr>" + "<td>" + f.vEmail + "</td>" + "<td>" + f.vUserName +  "</td>" + "<td>" + f.nDepartmentId + "</td>" + "<td>" + f.nEnabled + "</td>" + "<td>" + f.department + "</td>" + "<td>" + f.vFatherName + "</td>" + "<td>" + f.vSurname + "</td>" + "<td>" + f.vAfm + "</td>" + "<td>" + f.vUsertype + "</td>" + "<td>" + f.vName + "</td>" + "<td>" + f.nId + "</td>" + "<td>" + f.rolesDesc + "</td>" + "</tr>"
       $(tblRow).appendTo("#userdata tbody");
    });
   });
  });
  </script>
 </head>
 <body>
 <div class="wrapper">
 <div class="profile">
 <table id= "userdata" border="2">
 <thead>
        <th>Email</th>
        <th>User Name</th>
        <th>Department Id</th>
        <th>Enabled</th>
        <th>Department</th>
        <th>Father Name</th>
        <th>Surname</th>
        <th>Afm</th>
        <th>User Type</th>
        <th>Name</th>
        <th>Id</th>
        <th>Roles Desc</th>
    </thead>
    <tbody>

    </tbody>
   </table>
 </div>
 </div>
 </body>
 </html>

Solution 2:

how to display json data in jsp page using spring?

{
    "_id": {
        "$oid": "58d2280914fe0a6e07b7469f"
    },
    "title": "test",
    "sms": "Testing By arun",
    "content": "Testing By arun",**strong text**
    "source": "",
    "contenturl": "",
    "videolink": "https://www.youtube.com/watch?v=94BzBOpv42g",
    "images": ["http://localhost:8088/src_bsnlcms/1490167809719_1490167813678.png"],
    "imagestxt": ["Testing By Raj"],
    "services": ["1~1~1"],
    "tag": [],
    "starred": 0,
    "ctype": 3,
    "author": "arun",
    "content_id": 1490167809719,
    "createdate": 1490167809719
}

Post a Comment for "Display JSON Data In Jsp And Html Respectively"