• Post Reply Bookmark Topic Watch Topic
  • New Topic

Component ID xxx:xxx has already been found in the view

 
Beth Wheeling
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSF application which was running fine until I added a second command button to a particular page. When I click the new button, I get the following error:

java.lang.IllegalStateException: Component ID form1:j_id14 has already been found in the view.
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:833)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:817)
......

Here is the xhtml snippet from the page producing the error:

<h:form binding="#{KWIK_backing.form1}" id="form1">
<h:panelGrid id="msgGrid" binding="#{KWIK_backing.msgGrid}" columns="1" />
<h:panelGrid id="titleGrid" binding="#{KWIK_backing.titleGrid}" columns="2" />
<h:panelGrid id="mainGrid" binding="#{KWIK_backing.mainGrid}" columns="6" />
<h:panelGrid id="updateGrid" binding="#{KWIK_backing.updateGrid}" columns="2">
<h:commandButton value="Update" binding="#{KWIK_backing.updateBtn}"
id="updateBtn" action="#{KWIK_backing.updateBtn_action}"
immeidate="false" rendered="#{KWIK_backing.showUpdateBtn}">
</h:commandButton>
<h:commandButton id="exitBtn" value="Exit" binding="#{KWIK_backing.exitBtn}"
</h:commandButton>
</h:panelGrid>

The exit Btn currently does not do any action. The error I'm getting is produced when I click on the exit button only after having clicked on the update button. Otherwise, the exit button does not produce any errors.

Does anyone know what might be the cause of this error?
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a very common problem when you hot-update the View layout in a live application (usually as part of development). The problem comes from the fact that a View component tree has already been constructed, but the template no longer matches it. You can also get this problem when you use binding. Which is another reason why you should avoid binding wherever possible.

One way to reduce this sort of problem is to explicitly name (via "id") all naming containers and controls, since the root of the problem is that the auto-id generator has reassigned an ID to another object.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!