title: JSF 1.1 parameters in hidden field
body: <p>My goal is to pass a string with parameters (<code>Hello {0}</code>) from the backing bean to JavaScript. My current approach is to put the string in a <code>h:inputHidden</code> and let JS read the value onLoad.
  Sadly <code>f:param</code> inside of <code>h:inputHidden</code> is not working as in a <code>h:outputFormat</code>.</p>
  
  <p>What approach is generally advisible?</p>
  
  <ul>
  <li>I could combine the string with the parameters in the backing bean, but imo that should not be that beans concern.</li>
  <li>I could combine them in JS, but again that seems like reinventing the wheel (using <code>replace</code> functions ...)</li>
  <li>I dont see a (good) way to use a <code>h:outputFormat</code> but make it invisible to the user.</li>
  <li>I see no way to make <code>h:inputHidden</code> accept <code>f:param</code>s.</li>
  </ul>
  
  <p><strong>EDIT:</strong> The actual implementation used is Apache MyFaces 1.1.4, so I updated the title to JSF 1.1.</p>
  
  <p>Due to BalusCs answer I remembered my first (and discarded) approach:</p>
  
  <ul>
  <li><p>Direct inclusion in JS source code.</p>
  
  <pre><code>&lt;script&gt;
      var text = '&lt;h:outputFormat value="Hello {0}"&gt;&lt;f:param value="World" /&gt;&lt;/h:outputFormat&gt;';
  &lt;/script&gt;
  </code></pre></li>
  </ul>
  
  <p>Sadly in JSF 1.1 I have to use <code>&lt;f:verbatim&gt;</code> which makes the code <strong>really ugly</strong> (even eclipses syntax checker doesnt understand it - although its working):</p>
  
  <pre><code>&lt;f:verbatim&gt;
      &lt;script&gt;
          var text = '&lt;/f:verbatim&gt;
  &lt;h:outputFormat value="Hello {0}"&gt;&lt;f:param value="World" /&gt;&lt;/h:outputFormat&gt;
  &lt;f:verbatim&gt;';
          &lt;/script&gt;
  &lt;/f:verbatim&gt;
  </code></pre>
  
  <p>And an additional drawback is that I cannot put that in the <code>&lt;head&gt;</code> since it has to be inside <code>&lt;f:view&gt;</code>.</p>