title: Dynamic tooltip in JSP using Struts 2
body: <p>I'm trying to add a tooltip to a series of buttons. The text is dynamic in that it needs a parameter (shows a text with a page number) and is stored in <code>global.properties</code>:</p>
  
  <pre class="lang-jsp prettyprint-override"><code>page.nr.tooltip=Go to page {0}
  </code></pre>
  <p>I've tried several things, none of which work:</p>
  <pre class="lang-jsp prettyprint-override"><code>title=&quot;&lt;s:text name='page.nr.tooltip'&gt;
          &lt;s:param value='pageNum' /&gt;
          &lt;/s:text&gt;&quot;
  </code></pre>
  <p>I've also tried setting a variable and using that:</p>
  <pre class="lang-jsp prettyprint-override"><code>&lt;s:set var=&quot;ttStr&quot; value=&quot;&lt;s:text name='page.nr.tooltip'&gt;
          &lt;s:param value='pageNum' /&gt;
          &lt;/s:text&gt;&quot; /&gt;
  </code></pre>
  <p>But I can't seem to use it as a tooltip-text either. Tried either of these (and more)</p>
  <pre class="lang-jsp prettyprint-override"><code>value=&quot;ttStr&quot;
  value=&quot;$ttStr&quot;
  value=&quot;#attr[#ttStr]&quot;
  </code></pre>
  <p>which won't display the text.
  Any suggestions? Javascript is not possible because the application has to run in browsers with js turned off.
  I'm probably missing something really simple...</p>
  <h2>EDIT:</h2>
  <p>Guess I need to clarify a bit:
  <code>pageNum</code> is a variable I set like this:</p>
  <pre class="lang-jsp prettyprint-override"><code>&lt;s:set var=&quot;pageNum&quot; value=&quot;...&quot; /&gt;
  </code></pre>
  <p>and it is valid since I can use it and it has the correct value. I want to add the <code>pageNum</code> as a variable to the tooltip-text, something like this:</p>
  <pre class="lang-jsp prettyprint-override"><code>&lt;s:submit type=&quot;button&quot; class=&quot;...&quot;
     title=&quot;&lt;s:text name='page.nr.tooltip'&gt;
               &lt;s:param value='pageNum' /&gt;
            &lt;/s:text&gt;&quot;&gt;
  ...
  </code></pre>
  <p>This will not render the tooltip as &quot;<code>Go to page 4</code>&quot; (or whatever value pageNum has). It renders to &quot;<code>&lt;s:text name='page.nr.tootip' ...</code>&quot; - in other words the exact text in quotes from the example above.
  I know how to set and use variables from the action class - that wouldn't help here though.
  The title-attribute doesn't render the value &quot;Go to page &quot; at all. Even if I just write</p>
  <pre class="lang-jsp prettyprint-override"><code>&lt;s:submit type=&quot;button&quot; class=&quot;...&quot;
         title=&quot;&lt;s:text name='page.nr.tooltip'/&gt;&quot;
  </code></pre>
  <p>it displays <code>&lt;s:text name='page.nr.tooltip'/&gt;</code> as the tooltip text. Surprised this isn't working for me.</p>