通过 iPhone 发送文本到 servlet
我想做的是,我正在创建一个非常简单的iPhone应用程序、文本字段和一个按钮,当按下它时,它应该将文本字段中的文本发送到本地托管的servlet(glassfish 3.1.1),并且只是为了确保请求已完成,我输入一个简单的system.out.println("收到请求");
每次我按下按钮并检查服务器日志时,它都是空的! 我在浏览器中尝试了相同的网址,然后检查日志,日志中显示“收到请求”。
连接到按钮的方法是:
<代码> -(IBAction) connectToServer:(id)sender{ NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://localhost:8080/Test/Home"]]; NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; 我
真的不知道我是否在这里遗漏了任何东西,有什么帮助吗?
what i am trying to do is, i am creating a very simple iphone app, textfield and a button that when pressed it should send the text in the text field to a servlet hosted locally (glass fish 3.1.1) and just to make sure the request is done i type a simple
system.out.println("Request received");
and each time i hit the button and i go to check the server log, it empty !
i tried the same url in the browser then check the log,"Request received" is in the log.
the method connected to the button is:
-(IBAction) connectToServer:(id)sender{
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://localhost:8080/Test/Home"]];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
}
i really dont know if i am missing any thing here, any help ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尚未启动连接
因此,您的操作方法应如下所示:
或者,您可以使用不同的初始值设定项:
或者
You haven't started the connection
So, your action's method should look like:
Or, you may use a different initializer:
Or