【发布时间】:2012-02-01 04:00:16
【问题描述】:
如何将数据(表单数据)从 Swing 发送到 servlet。是否像在 html(form) 中指定 action 属性一样简单?
我正在使用此代码将数据传递给 Servlet:
URL url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
我必须将什么传递给 url,即代替 targetURL(我是否需要提及 Servlet 位置)以便我可以检索 servlet 中的值?
【问题讨论】: