title: JSF2.0 Composite Component ID generation
body: <p>I'm in the process of creating a new Web Application using JSF2.0 on Weblogic 11g.  I'm using JSF Ajax for form submission.  I'm quite new to JSF so still learning the ropes. The main page has 3 forms each on a jQuery tab. The original code had a lot of duplicate Input Fields like userName and password etc (id prepended with the form id i.e. myform1:userName). I decided it would be a good idea to use Composite Components for the duplicated fields.  Here is my Conponent code:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
    &lt;html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:composite="http://java.sun.com/jsf/composite"
    xmlns:h="http://java.sun.com/jsf/html"&gt;
  
  &lt;composite:interface&gt;
      &lt;composite:attribute name="value" required="true"/&gt;
  &lt;/composite:interface&gt;
  
  &lt;composite:implementation&gt;
  
  &lt;label for="#{cc.id}"&gt;User Name&lt;/label&gt;
  &lt;h:inputText
          id="#{cc.id}"
          size="15"
          value="#{cc.attrs.value}"
          required="true"
          label="User Name"&gt;
  &lt;/h:inputText&gt;
  &lt;/composite:implementation&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>And here is the call to the Component in the xhtml:</p>
  
  <pre><code>&lt;p&gt;
      &lt;cc:userName id="userName" value="#{soapTestingBackingBean.userName}"/&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>The problem now is that all my ids have an added element so have become myForm1:userName:userName.  Although this isn't a show stopper it does mean that my javascript now has to reference the long ids and is also the same in my Ajax calls (I generally execute @form but render specific elements).  I'm trying to make the code as readable and maintainable as possible.  So would appreciate it if anyone knew if there were an elegant work around for this or maybe some magic attribute I missed to turn it off. I did experiment with the forceID attribute from the tomahawk library but this just caused additional problems on my Ajax calls. Thanks.  </p>