<a> tag problem while generating javascript through java code
<p>How should I write a statement in Java to produce JavaScript in a page</p>

<pre><code>out.write("document.write('&lt; a href='str'&gt; '+str.slice(beg+1,end)+' &lt;/a&gt;');");
</code></pre>

<p>so that it will create statement in JavaScript </p>

<pre><code>document.write("&lt; a href=' "+str+" '&gt; "+str.slice(beg+1,end)+" &lt;/a&gt;"); //&lt; a
</code></pre>

<p>and the link will go to page whose address is stored in str </p>

<p>curently it is taking href value as str and not the value stored in str i.e. it is searching for page str</p>
