0
我想从桌面应用程序发送一些数据,以谷歌AWT小服务程序
我目前在我的系统(本地主机)尝试这个,因为我已经安装了Eclipse插件
我发送数据这样在谷歌AWT的servlet读取数据的发送由客户端
URL url = new URL("http://localhost:8888/calendar");
URLConnection urlConnection = url.openConnection();
urlConnection.setDoOutput(true);
PrintWriter out = new PrintWriter(urlConnection.getOutputStream());
String stringTosend = URLEncoder.encode(tf.getText(), "UTF-8");
out.write(stringTosend);
和我的servlet是这样
public class CalendarServlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/plain");
String input = req.getReader().readLine();
resp.getWriter().println(input);
}
}
但是我又回到为NULL。
什么是AWT的servlet? – keuleJ