I have several <p:messages>
elements that ought to handle different types of errors produced by a single bean. Now the clientID I get from my browser for one element is always the same, since there are no generated ids inside (that is 3 IDs altogether).
No matter which clientID I pass to FacesContext.addMessage(), I will always end up displaying all error messages on every <p:messages>
element.
One clientID as in browser: regelDetailAccordion:duoDlgForm2:regelDetail
another clientID as in browser: regelDetailAccordion:duoDlgForm1:messagesNeuerFehler
Bean code: FacesContext.getCurrentInstance().addMessage(X, new FacesMessage(...));
where X
is clientID (not) preceded by :
and/or only regelDetail
with and without :
in front. Tried all :(
Dialog-Include:
<ui:insert name="insertDuo"><ui:include src="/includes/duoRegelStmt.xhtml" />
</ui:insert>
Dialog that displays all my messages
:
<p:dialog widgetVar="newDuoDialog" id="newDuoDlg" modal="true">
<p:layout id="layout">
<p:layoutUnit position="west">
<ui:insert name="insertDetailStmt">
<h:form id="stmtDetailForm">
<ui:include src="/includes/stmtDetail.xhtml" /> <!-- left side -->
</h:form>
</ui:insert>
</p:layoutUnit>
<p:layoutUnit position="center">
<ui:insert name="insertDetailRegel">
<ui:include src="/includes/regelDetail.xhtml"/> <!-- right side -->
</ui:insert>
</p:layoutUnit>
</p:layout>
</p:dialog>
Right side of the dialog that displays 2 of my 3 messages
:
<ui:composition>
<h:panelGrid id="unterheaderUndAccordion">
<h:panelGrid rendered="#{...}" id="regelUnterheader"/>
<p:accordionPanel multiple="true" activeIndex="0,1" id="regelDetailAccordion" rendered="#{...}">
<p:tab>
<h:form id="duoDlgForm1">
<ui:insert name="neuerFehler">
<ui:include src="/includes/neuerFehler.xhtml" />
</ui:insert>
<h:selectOneMenu value="#{regelBean.selectedFehlerCode}" id="selFCode"
onChange="submit()" process="@this" valueChangeListener="#{regelBean.changeFehlerCode}">
<p:ajax event="change" update="duoDlgForm1" />
<f:selectItems ... />
</h:selectOneMenu>
</h:form>
</p:tab>
<p:tab>
<h:form id="duoDlgForm2">
<h:panelGrid>
<p:messages id="regelDetail" showDetail="true" closable="true"/>
</h:panelGrid>
</h:form>
</p:tab>
</p:accordionPanel>
</h:panelGrid>
</ui:composition>
neuerFehler contains a messages
that is defined like this
<p:messages id="messagesNeuerFehler" showDetail="true" closable="true"/>
In my thinking, when I enter the correct value for X
, only the proper messages field will display a message, even if other messages
are updated. If that is true, what is the correct clientID I have to enter? Big thanks in advance, I'm at wit's end :(