Aritz
Aritz

Reputation: 31649

Primefaces: adding growl into my view

I'm implementing a web app using PrimeFaces components in the view part. My problem comes when I want to use a < p:growl > anywhere, I have an error when the page is loaded. Firebug says: "widget_j_idt25_HeadLogin_messages is not defined". It looks like when PrimeFaces are generated, javascript is trying to use the component, it finds that it's not defined.

However, when I remove the tag everything works well and the JSF error messages are properly displayed. I'm using PrimeFaces 3.1.1 library, any ideas about how to solve this issue?

Here you've my code:

<?xml version='1.0' encoding='ISO-8859-15' ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">

<h:form id="download_manager_form">

    <p:growl id="messages" />

    <p:ajax event="click" update="messages"/>

    <p:dataTable value="#{downloadManagerBean._TableBean._List}"
        var="download" style="width:100%">
        <f:facet name="header">
            <h:outputText value="#{msg.DOWNLOAD_MANAGER_TITLE}" />
        </f:facet>
        <p:column sortBy="#{download._FileName}"
            filterBy="#{download._FileName}"
            headerText="#{msg.FILE_PATH_DOWNLOAD}">
            <p:commandLink
                actionListener="#{downloadManagerBean.actionDownload}">
                <h:outputText value="#{download._FileName}" />
                <f:param name="ID" value="#{download._id}" />
            </p:commandLink>
        </p:column>
        <p:column sortBy="#{download._OverdueDate}"
            filterBy="#{download._OverdueDate}"
            headerText="#{msg.OVERDUE_DATE_DOWNLOAD}">
            <h:outputText value="#{download._OverdueDate}" />
        </p:column>
        <p:column sortBy="#{download._Created}"
            filterBy="#{download._Created}" headerText="#{msg.FILE_CREATED}">

            <h:outputText value="#{download._Created}" />
        </p:column>
        <p:column sortBy="#{download._FileSize}"
            filterBy="#{download._FileSize}" headerText="#{msg.FILE_SIZE}">
            <h:outputText value="#{download._FileSize}" />
        </p:column>

    </p:dataTable>
</h:form>

Upvotes: 0

Views: 3616

Answers (1)

Aritz
Aritz

Reputation: 31649

Solved. I had h:head tag missing in my main page! By the way, it's not necessary to update the growl component, even without declaring autoupdate, it's enough to add a faces message to the faces context in the server side!!

Upvotes: 1

Related Questions