I am making an iphone application which has user information on a web server. When user wants to login, username and password will be sent to web server. In my case to a java servlet. Then servlet will check username and password in database and send response to iphone. I managed to send username and password using ASIHTTPRequest. But i dont know how should servlet send response back to iphone app to tell that username and password matches some user's account or not. I implemented following functions:

 - (void)requestFailed:(ASIHTTPRequest *)request
 {
[self.activity stopAnimating];
NSLog(@"Request failed: %@",[request error]);

 } 

 - (void)requestFinished:(ASIHTTPRequest *)request 
 { 
[self.activity stopAnimating];
NSLog(@"Response %d ==> %@", request.responseStatusCode, [request responseString]);

 } 

in console out put is: Response 200 ==>

How can i send response from my java servlet to the same request which comes from iphone? Thanks in advance.

有帮助吗?

解决方案

[request responseString] is what you can see in your web browser. Just response a string, "OK", "NG" for example, on your server is OK (a JSON or a XML string is even better).

其他提示

i suggest using RESTKit

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top