简体   繁体   English

如何将信息从 android 传输到 servlet?

[英]How to transfer information from android to servlet?

i would like to send some information from within my application to a servlet that will then jsut display the information to the console window(running server through eclipse).我想从我的应用程序中发送一些信息到一个servlet,然后将信息显示到控制台窗口(通过eclipse运行服务器)。

Firstly how do i send the information(a simple string) to servlet?首先,我如何将信息(一个简单的字符串)发送到 servlet?

Secondly what do i call in the servlet for it to print to the console?其次,我在 servlet 中调用什么以将其打印到控制台?

Also should i for the first step set up a Service to run the sending of information in the background?我还应该在第一步设置一个服务以在后台运行信息发送吗?

  • WebServices网页服务

  • HttpURLConnection HttpURL连接

Previous answer from @Jigar is complete, a more general way to say it is that you can pass a parameter to a http request made from your android app to the server. @Jigar 先前的回答是完整的,更一般的说法是,您可以将参数传递给从 android 应用程序向服务器发出的 http 请求。 It can be with post or get, get is simpler.它可以与 post 或 get 一起使用,get 更简单。

Regards, Stéphane问候, 斯蒂芬

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM