title: How to prevent frame injection (clickjacking) in java application?
body: <p>How can we prevent frame injection in Java application?</p>
  
  <p>Like in a Penetration testing, 
  it is found that if a hacker drafts a demo html page, 
  and inside that page he has used iframe, 
  which has the URL of the working application, 
  he/she can see the data through that URL/request(created in an iframe).</p>
  
  <p>suppose this is the hackers file, test.html:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;&lt;body&gt;
  &lt;iframe id="inner" src="http://hostname:8080/Application_Name/ABC/DEF/SomePage.jsp?ABC=QWERTYL&amp;XYZ=1&amp;CDE=24" width="600" height="400" scrolling="yes"&gt;
  
  &lt;/iframe&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And now the hacker is able to retrieve the data within the application. How to stop this?</p>