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