Inline JSON

Title Key JSON Rendered Status
First Name firstName {"title":"First Name","key":"firstName"} First Name: 0: {"last":false,"count":0,"index":0,"first":true}
Last Name lastName {"title":"Last Name","key":"lastName"} Last Name: 1: {"last":false,"count":1,"index":1,"first":false}
Address address {"title":"Address","key":"address"} Address: 2: {"last":false,"count":2,"index":2,"first":false}
City city {"title":"City","key":"city"} City: 3: {"last":true,"count":3,"index":3,"first":false}

This example demonstrates inline JSON being used to render a table. The contents of the loop status variable are demonstrated in the Status column.

<%@taglib uri="convirgance:web" prefix="virge" %> <virge:json var="list" scope="page"> [ { "title": "First Name", "key": "firstName" }, { "title": "Last Name", "key": "lastName" }, { "title": "Address", "key": "address" }, { "title": "City", "key": "city"} ] </virge:json> <virge:iterate var="item" items="${list}" status="loop"> <tr> <td>${item.title}</td> <td>${item.key}</td> <td>${item}</td> <td>${item.title}: <input type="text" id="${item.key}" name="${item.key}"></td> <td>${loop.index}: ${loop}</td> </tr> </virge:iterate>