title: Acquire full prefix for a component clientId inside naming containers with JSF 2.0
body: <p>I am updating a component via AJAX in JSF:</p>
  
  <pre><code>&lt;h:form&gt;
      &lt;h:outputLink&gt;Click me
          &lt;f:ajax event="click" render=":messages" /&gt;
      &lt;/h:outputLink&gt;
  &lt;/h:form&gt;
  
  &lt;h:messages id="messages" globalOnly="true" /&gt;
  </code></pre>
  
  <p>As the <code>&lt;h:messages /&gt;</code> resides outside <code>&lt;h:form /&gt;</code> I have to prefix the ID with colon (<code>:</code>). This works.</p>
  
  <p>However, if I put this same code into a component and include that component into my page, the code fails. The reason is that <code>:messages</code> declaration refers to the root of the component hierarchy, while the <code>&lt;h:messages /&gt;</code> component that I want to update actually resides under my custom component, which resides under the page (so the location is of style <code>:myComponent:messages</code>.</p>
  
  <p>Inside my component, how can I achieve the correct prefix to the <code>&lt;h:messages /&gt;</code> component? I know that I can manually assign ID to my component, and use that to prefix the reference (like <code>:#{cc.attrs.id}:messages</code>). However, I don't know at which level of component hierarchy this component lies, so the required prefix might even be something like <code>:foo:bar:x:y:messages</code>.</p>