문제

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