title: Duplicate component id in JSF
body: <p>I am working through an example in the "JSF in action book" which displays a dynamic grid(html table) of numbers driven by an input. The jsp portion is below</p>
  
  <pre><code>&lt;p&gt;
  &lt;h:panelGrid id="controlPanel"
  binding="#{helloBean.controlPanel}"
  columns="20" border="1" cellspacing="0"/&gt;
  &lt;/p&gt;
  &lt;h:commandButton id="redisplayCommand" type="submit"
  value="Redisplay"
  actionListener="#{helloBean.addControls}"/&gt;
  </code></pre>
  
  <p>The binding bean code is below</p>
  
  <pre><code>public void addControls(ActionEvent actionEvent)
  {
      Application application = FacesContext.getCurrentInstance().getApplication();
      List children = controlPanel.getChildren();
      children.clear();
      for (int count = 0; count &lt; numControls; count++)
      {
          HtmlOutputText output = (HtmlOutputText)application.
          createComponent(HtmlOutputText.COMPONENT_TYPE);
          output.setValue(" " + count + " ");
          output.setStyle("color: blue");
          children.add(output);
      }
  }
  </code></pre>
  
  <p>The code is functional for a few values and then out of nowhere i get this error</p>
  
  <p>"javax.servlet.ServletException: Component ID welcomeForm:j_id51 has already been found in the view"</p>
  
  <p>There doesent seem to be a pattern to when this exception occurs. Is there an way to "drop" a component from its parent?</p>