how to generate canonical tag dynamically in jsp
<p>Need to add canonical tag in jsp</p>

<pre><code>&lt;link rel="canonical" url="http://www.example.com"/&gt;
</code></pre>

<p>But i dont want to hard code the url value.</p>

<p>How can i achieve this.</p>

<p>I have tried using data binding techniques but in view source, 
link tag is shown as</p>

<pre><code>&lt;link rel="canonical" href="" data-bind="attr:{href: ko.toJS($root.seoURLCanonical)}"/&gt;
</code></pre>

<p>instead of </p>

<pre><code>&lt;link rel="canonical" url="http://www.example.com"/&gt;
</code></pre>

<p>while inspecting we can see canonical link tag as</p>

<pre><code>&lt;link rel="canonical" href="http://www.example.com" data-bind="attr:{href: ko.toJS($root.seoURLCanonical)}"/&gt;
</code></pre>