{" toDate":" 2014/07/07"," fromDate":" 2014/05 / 01",&# 34; imeiNo":" 1234567890", " phoneNumber":1234567890, " emailId":“” }
响应数据包:
{
"ResponseCode": "M00110",
"ResponseMessage": "Records found",
"ResponseType": "01",
"RequestData": [
{
"TxnId": 1,
"Date": "2014/10/12",
"Card": "888888345",
"CardType": 1,
"Bank": "",
"Merchant Name": "ABC Corp",
"Amount": "$250"
},
{
"TxnId": 1,
"Date": "2014/10/12",
"Card": "88888345",
"CardType": "",
"Bank": "XYZ BANK",
"Merchant Name": "ABC Corp",
"Amount": "$250"
}
答案 0 :(得分:-1)
可以使用ObjectMapper类的jackson库将响应字符串转换为map或entity类,然后可以使用相同的map或entity类来显示jsp上的字段。
例如: - 为响应数据包创建实体;
类ResponsePacket {
List<RequestData> requestData;
}
然后通过以下方式创建实体: -
ResponsePacket responsePacket = new ObjectMapper()。readValue(responseString,ResponsePacket.class);
在jsp中: -
${data.txnId}
${data.date}