title: Web application using Ajax with Java based server- Security related
body: <p>I have a web application which uses Ajax for several tasks.  It has Java as it's middleware (Struts 1.x)</p>
  
  <p>The issue is that my application was analyzed for potential security risks using static code analysis.  It was found in the analysis that use of the following code is considered vulnerable.</p>
  
  <p>e.g.</p>
  
  <pre><code>// Method invoked by Ajax
  public ActionForward execute(...)
  {
      PrintWriter out = response.getWriter();
  
      out.println("Ajax Response");
  
      return null;
  }
  </code></pre>
  
  <p>The report clearly mentions that the use of PrintWriter is harmful and prone to XSS (Cross Site Scripting).
  I tried searching online if this is a potential threat, but could not find anything useful.
  Kindly advise if this is an issue and what are my alternatives.</p>
  
  <p>EDIT - The problem was found with <strong>out.println</strong> statement</p>
  
  <p>Thanks,
  Siddharth</p>