I am creating my array as such that has a key value (Name and Email) like this and with a loop populating as below:
for(x y : model) {
obj_JSONObject1.append(x.getName(), x.getValue());
}
jsonArray.put(obj_JSONObject1);
My Array looks like this:
[
{
"Email": [
"email1@email.com",
"abc@liferay.com"
],
"Name": [
"name1",
"name2"
]
}
]
However I am having problem displaying them in an html table from my jsp. I tried:
<c:forEach begin="0" end="${userList.length() -1}" var="i">
<tr>
<td>${userList.getJSONObject(i).get("Name")}
</td>
<td>${userList.getJSONObject(i).get("Email")}
</td>
</tr>
</c:forEach>
The table is created as :
Name Email
["name1","name2"] ["email1@email.com","abc@liferay.com"]
Can someone tell me how to display the records in tabular format(the values should be on each rows and not sidewide? Thanks in advance!