title: How to send response from servlet to client side?
body: <p>I am trying to send response in form of an .xml file from a Java servlet to the client. For that I have written the code below:</p>
  
  <pre><code>if (result) {
      response.setContentType("text/xml");
  
      PrintWriter out = response.getWriter();
  
      out.println("&lt;Login&gt;");
      out.println("&lt;status&gt;"+successStatus+"&lt;/status&gt;");
      out.println("&lt;username&gt;"+userDTO.getFirstname()+"&lt;/username&gt;");
      out.println("&lt;sessionId&gt;"+hSession.getId()+"&lt;/sessionId&gt;");
      out.println("&lt;timestamp&gt;"+hSession.getLastAccessedTime()+"&lt;/timestamp&gt;");
      out.println("&lt;timeout&gt;"+hSession.getLastAccessedTime()+"&lt;/timeout&gt;");
      out.println("&lt;/Login&gt;");
  }
  </code></pre>
  
  <p>How can I check on the client whether I get this response or not?
  Do I need to send the response explicitly or is the above code sufficient to send the response to the client?</p>
  
  <p>Thanks in advance</p>