Question

I have the following Facelets code with an update on the <p:growl> component after the saving action. But I have the following exception while rendering the page :

javax.servlet.ServletException: Cannot find component with expression ":principal:display" referenced from "mainForm:form1:j_idt27".

<ui:define id="principal" name="content">
    <p:growl id="display" showDetail="true" sticky="false" />

    <p:panel header="Gestion de projets">

        <h:form id="form1">
            <h:panelGrid columns="3">
                <h:outputText value="Nom du projet: *" />
                <p:inputText value="#{gestionProjetBean.nomProjet}"
                    required="true" label="Nom du projet" />
                <p:commandButton value="Save"
                    actionListener="#{gestionProjetBean.creerProjet(gestionProjetBean.nomProjet)}"
                    update=":principal:display" />
            </h:panelGrid>
        </h:form>
Was it helpful?

Solution

I finally found the solution: it should be update=":mainForm:display"

For those who are facing the same problem, firebug helped me finding the real id of the component, by displaying the source code of the page and searching for my component on it.

There, I found this:

<div id="mainForm:msgs" class="ui-messages ui-widget" aria-live="polite"></div> <span id="mainForm:display"></span> <script id="mainForm:display_s" type="text/javascript"> $(function(){PrimeFaces.cw('Growl','widget_mainForm_display',{id:'mainForm:display',sticky:false,life:6000,escape:true,msgs:[]});}); </script>

Also don't forget to prepend the id by an ":" (because every id should start with the NamingContainer separator character ":")

OTHER TIPS

don't use :principal:display try just :display

Try this give a id to the panel component and modify code like below

:panelid:display

this works for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top