title: Sending data from swing to Servlet
body: <p>How to send data (form data) from a Swing to the servlet. Is it as simple as specifying in action attribute as in html(form)?</p>
  
  <p>I am passing data to Servlet using this code:</p>
  
  <pre><code>URL url = new URL(targetURL); 
  connection = (HttpURLConnection)url.openConnection();
  connection.setRequestMethod("POST");
  </code></pre>
  
  <p>What is that I have to pass to url i.e in place of <code>targetURL</code> (do I need to mention Servlet location) so that I can retrieve values in the servlet?</p>