can not find growl in p:column

UI Components for JSF
Post Reply
wuqian2hcs
Posts: 28
Joined: 19 Jun 2014, 06:18

20 Aug 2014, 12:12

Hi,
I code page with JSF, I want to update the growl when I click the commandButton, but there is a exception:

Code: Select all

ERROR [io.undertow.request] (default task-5) UT005023: Exception handling request to /accWeb/faces/index.xhtml: javax.servlet.ServletException: Cannot find component with expression "growl" referenced from "j_idt11:form:j_idt19:0:j_idt24".
and my page code:

Code: Select all

        <h:form id="form">
                        <p:growl id="growl"/>
                        <p:commandButton icon="ui-icon-plusthick"
                                onclick="PF('addDeviceDlg').show();"/>
                        <p:commandButton icon="ui-icon-calendar" 
                                action="#{deviceListView.showSimpleTable}"/>
                        <p:commandButton icon="ui-icon-calculator" 
                                action="#{deviceListView.showDetailTable}"/>
                        <!-- the simple data table -->
                        <p:messages for="deviceTable" />
                        <p:dataTable var="device" 
                                value="#{deviceListView.devices}"
                                widgetVar="deviceFilter"
                                rendered="#{!deviceListView.switchTable}">
                            <f:facet name="header">
                                <p:outputPanel style="height:30px"> 
                                     <p:inputText id="globalFilter" 
                                            onkeyup="PF('deviceFilter').filter()" 
                                            style="width:150px;float:right" />  
                                     <h:outputText value="#{locale.dev_search}" 
                                            style="float:right" />  
                                </p:outputPanel> 
                            </f:facet>
                            <p:column headerText="#{locale.dev_devName}" 
                                    sortBy="#{device.deviceName}" 
                                    filterBy="#{device.deviceName}" 
                                    filterMatchMode="contains" 
                                    filterStyle="display:none; visibility:hidden;">
                                <p:outputLabel value="#{device.deviceName}"/>
                                <p:commandButton icon="ui-icon-closethick"
                                        title="#{device.uid}"
                                        action="index"
                                        actionListener="#{deviceListView.deleteDevice}"
                                        style="float:right"
                                        update="growl"/>
                            </p:column>
                            
                            <p:column headerText="#{locale.dev_online}">
                                <p:outputLabel value="#{device.online}"/>
                            </p:column>
                            
                            <p:column headerText="#{locale.dev_alarm}">
                                <p:outputLabel value="#{device.alarmEnable}"/>
                            </p:column>
                            
                            <p:column headerText="#{locale.dev_guard}">
                                <p:outputLabel value="#{device.guardEnable}"/>
                            </p:column>
                        </p:dataTable>
                        
                        <!-- the detail data table -->
                        <p:dataTable var="device" 
                                value="#{deviceListView.devices}" 
                                widgetVar="deviceTable"
                                rows="1" 
                                paginator="true" 
                                rendered="#{deviceListView.switchTable}">
                            <p:column>
                                <p:panelGrid columns="3">
                                    <p:outputLabel value="#{locale.dev_sn}"/>
                                    <p:outputLabel value="#{device.uid}"/>
                                    <p:inputText value="#{device.uid}" readonly="true"/>
                                    
                                    <p:outputLabel value="#{locale.dev_devName}"/>
                                    <p:outputLabel value="#{device.deviceName}"/>
                                    <p:inputText value="#{device.deviceName}"/>
                                    
                                    <p:outputLabel value="#{locale.dev_online}"/>
                                    <p:outputLabel value="#{device.online}"/>
                                    <p:outputLabel/>
                                    
                                    <p:outputLabel value="#{locale.dev_alarm}"/>
                                    <p:outputLabel value="#{device.alarmEnable}"/>
                                    <p:inputText />
                                    
                                    <p:outputLabel value="#{locale.dev_guard}"/>
                                    <p:outputLabel value="#{device.guardEnable}"/>
                                    <p:inputText />
                                </p:panelGrid>
                            </p:column>
                        </p:dataTable>
                        <p:panel style="text-align:center;border:0;" >
                            <p:commandButton value="#{locale.dev_submit}" 
                                    rendered="#{deviceListView.switchTable}" 
                                    action="#{deviceListView.editDevice}" 
                                    style="float:center"/>
                        </p:panel>
                        
                        <!-- add device dialog  -->
                        <p:dialog position="center"
                                header="add device"
                                id="addDevice"
                                widgetVar="addDeviceDlg"
                                style="text-align :center;">
                            <h:panelGrid columns="2" cellpadding="5">
                                <p:outputLabel value="uid"/>
                                <p:inputMask value="#{deviceListView.uid}" 
                                        mask="****************"
                                        tabindex="1"/>
                                <p:outputLabel value="devname"/>
                                <p:inputText value="#{deviceListView.devName}" tabindex="2"/>
                                <p:outputLabel value="devpassword"/>
                                <p:password value="#{deviceListView.devPwd}" tabindex="3"/>
                            </h:panelGrid>
                            <p:commandButton value="add device" 
                                    action="#{deviceListView.addDevice}" 
                                    onclick="PF('addDeviceDlg').hide()"
                                    update="growl" 
                                    tabindex="4"/>
                        </p:dialog>
                    </h:form>
When I delete the first(in the p:column) update="growl, the exception did not display, and other updates work well.
how can I fix the exception.
any ideas? Thank you!
jsf2.1
wildfly 8.1
primefaces 5.0

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

20 Aug 2014, 15:04

wuqian2hcs wrote:how can I fix the exception.
any ideas? Thank you!
by referencing the growl correctly . look in the generated xhtml in the browser what the actual id is

wuqian2hcs
Posts: 28
Joined: 19 Jun 2014, 06:18

21 Aug 2014, 04:06

kukeltje wrote: by referencing the growl correctly . look in the generated xhtml in the browser what the actual id is
Thank you!
But it work in other button,do not work in the first(in p:column) button.
if I add the first update="growl",the browser show 'Internal Server Error'. I can not catch the actual id.
then I delete(but I need it) the first update="growl".it works well.and the actual id is :<span id="j_idt11:j_idt13:growl"></span>
jsf2.1
wildfly 8.1
primefaces 5.0

wuqian2hcs
Posts: 28
Joined: 19 Jun 2014, 06:18

21 Aug 2014, 04:26

wuqian2hcs wrote: But it work in other button,do not work in the first(in p:column) button.
if I add the first update="growl",the browser show 'Internal Server Error'. I can not catch the actual id.
then I delete(but I need it) the first update="growl".it works well.and the actual id is :<span id="j_idt11:j_idt13:growl"></span>
Ok, I fix it:
I add another growl in the p:column before the button.and it work well.
Is it right?
jsf2.1
wildfly 8.1
primefaces 5.0

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

21 Aug 2014, 12:21

The correct update is :form:growl
Tip:don't give a component an id the same as the component name.
Learn more about basic JSF by going through a good tutorial.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

wuqian2hcs
Posts: 28
Joined: 19 Jun 2014, 06:18

22 Aug 2014, 04:10

andyba wrote:The correct update is :form:growl
Tip:don't give a component an id the same as the component name.
Learn more about basic JSF by going through a good tutorial.
OK,Thank you!
Your mean 'update=":form:growl" '.
This method,I have had a try for it. But it did not work.
Thank you for your tips.
jsf2.1
wildfly 8.1
primefaces 5.0

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

22 Aug 2014, 08:53

that is because you have a another nameingcontainer around the form I think... Next time, don't post code snippets, but a full but minimal example.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests