Communication between application and jsp

Joined
Jun 3, 2011
Messages
54
Reaction score
0
Points
6
Dear All,

I am trying to pass some values (like username and password) from my application to some jsp file lying on some server. And code for this is:
Code:
NSString *post = [NSString stringWithFormat:@"username=%@&password=%@",username, password];	
	NSData *postdata = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
	request= [[[NSMutableURLRequest alloc] init] autorelease];
	[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://128.9.45.182:8080/DV_DEMO/jsp/test.jsp"]]];
	[request setHTTPMethod:@"POST"];
	[request setHTTPBody:postdata];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];

I am also using all the NSURLConnection delegate in the program
And in the jsp file,
Code:
<% 
String username = request.getParameter("username") ;
String password = request.getParameter("password");
out.println(username + password);
%>

And I am getting proper value in the jsp.
But now I want to return back some string to the application.Say after username and password verification, some string should be returned back to the application. How this can be done?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top