执行查询后将数组列表从 servlet 发送回 iPhone 应用程序
我有一个简单的 iPhone 应用程序,我想做的是:
我有一个选择器视图,我必须通过向 servlet 发送请求并执行查询并将结果发送回来填充它。
问题是 servlet 将结果作为字节流发送,而我需要它作为数组。
问题是:
如何从 servlet 向应用程序发送数组以及如何处理?
I have a simple iPhone application, and what I am trying to do is the following:
I have a picker view, and I have to fill it by sending a request to servlet and execute a query and send the the result back.
The problem is that the servlet is sending the result as a stream of bytes and I need it as an array.
The question is:
How to send an array from servlet to the application and how to deal with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

您没有提及您是否控制该 servlet。如果你确实控制它,你可以将响应格式化为 iOS plist 格式,然后直接将结果读入(比如说)NSArray。如果您不控制 servlet,那么您需要了解它返回的数据的格式并自行将其格式化为 NSArray。
You don't mention whether or not you control the servlet. If you do control it you can format the response in iOS plist format and so directly read the result into a (say) NSArray. If you don't control the servlet, well, you need to understand the format of the data it returns and format it yourself into an NSArray.