title: How to send string to servlet from my java class
body: <p>Client.java 
  sending string into servlet</p>
  
  <pre><code>    String url = "http://localhost:8084/Lab/url";
  
      URL obj = new URL(url);
      HttpURLConnection con = (HttpURLConnection) obj.openConnection();
  
      // optional default is GET
      con.setRequestMethod("GET");
              con.setDoInput(true);
              con.setDoOutput(true);
              dos = new DataOutputStream(con.getOutputStream());
              dos.writeBytes(resultJson.toString());
      int responseCode = con.getResponseCode();
              BufferedReader in = new BufferedReader(new InputStreamReader(
                                  con.getInputStream()));
              String inputLine;
              while ((inputLine = in.readLine()) != null) 
                  System.out.println(inputLine);
  
              dos.flush();
              dos.close();
              in.close();
  </code></pre>
  
  <p>Servlet
  getting values from client and return </p>
  
  <pre><code>protected void processRequest(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
      response.setContentType("text/html;charset=UTF-8");
      PrintWriter out = response.getWriter();
  </code></pre>
  
  <p>I dont know what to do next. </p>