title: Receiving data in servlet from swing
body: <p>I connected to servlet from swing using <code>HttpURLConnection</code>. I did not understand this code:</p>
  
  <pre><code> DataOutputStream wr = new DataOutputStream(
   connection.getOutputStream()); //connection is obj of HttpurlConnection class.
  
   wr.writeBytes(un);//un contains username retrieved from textbox from the swing 
   wr.flush();
   wr.close();
  </code></pre>
  
  <p>What is the way to read values in the servlet, so that I can do further process (like inserting into database etc..)</p>
  
  <p>Is there any method other than above method or can I get values through request object?</p>