1

here is my code:

<h:selectOneMenu value="#{statistic.currentChoice}"
                        onchange="submit()"
                        valueChangeListener="#{statistic.changedCurrentChoice}"
                        id="statistic_type">
                        <f:selectItems value="#{statistic.statisticChoices}" />
                    </h:selectOneMenu>

When I select an item once the form is submitted and the page is refreshed twice. So far so good. If I further reselect another item in the select menu, the page this time is refreshed 4 times and causes the error:

Component ID nav_panel-nav_item0 has already been found in the view

to be thrown. The nav_panel-nav_item0 ID comes from another header.xhtml file

<h:form id="nav" styleClass="nav" rendered="#{data.showMenu}">
    <t:panelNavigation2 id="panel-nav" expandAll="true">
        <t:navigationMenuItems value="#{data.menuItems}" />
    </t:panelNavigation2>
</h:form>

which is included in the XHTML file with the select menus as follows:

<ui:composition template="header.xhtml"

To know how often the page is refreshed, I use system.out.print within the getMenuItems() method of data.

Why does the page get refreshed so often? or Why is the duplicate ID error being thrown.

Menelaos
  • 23,508
  • 18
  • 90
  • 155
edmond
  • 833
  • 3
  • 13
  • 31
  • You have probably noticed that I have asked two questions. And the last one deals with duplicate component ID error. – edmond Feb 06 '15 at 13:01
  • did you checked all the possibilities given in BalusC's answer here: http://stackoverflow.com/questions/2101755/im-getting-duplicate-id-error-after-adding-binding-attribute – Tarik Feb 06 '15 at 15:41
  • My backing bean, which in this case is _data_ does indeed use the session scope. I can't use the request scope since it does not apply to my application. In fact I hold some data in that bean that I use throughout the navigation. – edmond Feb 06 '15 at 15:51
  • I don't think it's related to the session scope, are you using any binding attribute? – Tarik Feb 06 '15 at 22:36
  • 1
    The render condition on the `` doesn't look good; try to move that on to a panel of some sort. Putting that condition on a critical component like a jsf form can give you some inconsistent behaviour like you're currently experiencing – kolossus Feb 07 '15 at 04:58
  • I will try removing that condition as soon as I get at work on monday. I have been struggling with that duplicate component ID error for a couple of days. I do not use any binding attribute. – edmond Feb 07 '15 at 15:43
  • I have moved the render condition to a surrounding panelGroup but it doesn't work. Duplicate component ID error persists. – edmond Feb 09 '15 at 08:05

0 Answers0