简体   繁体   English

如何使用以下从服务器收到的响应并将其保存到数据库

[英]how to use below response received from server and save in to database

我将联系人发送到服务器以检查其是否在服务器上注册,服务器返回此响应如何使用它并保存到数据库编号中,并根据编号结果正确与否7837580550,false,9780929022,true,9855772008,false,

Use a List of Map to the store the values and insert into database using it. 使用地图列表存储值,并使用它插入数据库。

String[] arr=response.split(",");
List<Map<String,String>> list = new ArrayList();
for(int i = 0; i<arr.length; i+2){
String contactNo = arr[i];
String result = arr[i+1];
Map<String,String> m = new HashMap();
m.put(contactNo,result);
list.add(m);
}

As per my thinking you should get response in XMl format. 按照我的想法,您应该以XMl格式获得答复。 I will be easy to handle and easy to manage the parsed output. 我将很容易处理和管理已解析的输出。

<Response>
  <MobileNo>7837580550</MobileNo>
  <Status>False</Status>
  <MobileNo>9780929022</MobileNo>
  <Status>True</Status>
  <MobileNo>9855772008</MobileNo>
  <Status>False</Status>
</Response>

While parsing you can store parsed information in different array. 解析时,您可以将解析的信息存储在不同的数组中。 Rest you know how to get data from array and store in db. 剩下的你知道如何从数组中获取数据并将其存储在db中。

Hope this will help. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未从服务器收到响应 - Response not received from server 没有收到来自服务器的响应 - No response received from the server 从服务器收到的XML响应中的特殊字符 - Special characters in XML response received from server 如何在服务器上显示或使用从Android手机接收的图像 - how to display or use an image received from Android phone on the server 在sqlite数据库中保存服务器响应(离线) - save server response in sqlite database(offline) 如何从Mock-Server返回响应并将其保存到变量? - How to return a response from Mock-Server and save it to a variable? 在Windows上进行Dockererized Kong操作,显示“从上游服务器收到无效响应” - Dockererized Kong on windows giving “An invalid response was received from the upstream server” 将 For-Each-Loop 中 Retrofit2 调用的服务器响应保存到文件、数据库或新列表 / ArrayList - Save Server Response from Retrofit2 Call in For-Each-Loop to file, database or new List / ArrayList 将从服务器收到的Excel文件保存在客户端计算机上 - Save excel file received from the server on client machine 如何从Jmeter中的响应数据中提取以下URL和响应代码 - How to extract Below URL and Response Code from response data in Jmeter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM