why is '<' showing as &lt;
<p>I am outputting a string form my java class like this</p>

<pre><code>String numQsAdded = "&lt;div id='message1'&gt;"+getQuestion()+"&lt;/div&gt;";
</code></pre>

<p>This string is being sent back to the client side as a XMLHttpRequest.  So, in my jsp page I have a javascript alert method that prints out the string returned from the server. it translates '&lt;' to <code>&amp;lt;</code> and '>' to <code>&amp;gt;</code></p>

<p>how can i avoid this?</p>

<p>I have tried changing my string to:</p>

<pre><code>String numQsAdded = "&amp;lt;div id='message1'&amp;gt;"+getQuestion()+"&amp;gt;/div&amp;lt;";
</code></pre>

<p>but this has even worse effects. then '&amp;' is translated as 'amp'</p>
