如何從Swing向servlet發送數據(表單數據)。它是否像在HTML(表單)中一樣簡單,只需指定action屬性?將數據從swing發送到Servlet
我傳遞數據使用此代碼Servlet的:
URL url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
是什麼,我要傳遞給URL即代替targetURL
(做我需要一提的Servlet的位置),這樣我就可以檢索值在servlet中?
url = new URL(targetURL); connection =(HttpURLConnection)url.openConnection(); connection.setRequestMethod(「POST」);我已經看到這個代碼在一些鏈接,targeturl =目標或servlet - 它是正確的嗎?我們是否需要設置所有連接參數,如setreqmethod,設置req屬性? – user1168647 2012-02-01 04:24:07