0
votes

I have a problem with the update attribute, I want to update a markup that is outside the datatable but always I have an error here is my xhtml page :

    <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>

        <ui:composition template="./template_admin.xhtml">

            <ui:define name="tohead">
            </ui:define>

            <ui:define name="content">

                <p:fieldset id="panel" legend="Stock papiers">
                    <p:messages id="msgs"/>
                    <p:commandButton style="margin-bottom: 20px;margin-top: 20px;" ajax="false" value="Nouveau Type" action="newPapier" />

                    <p:dataTable var="car" value="#{addPapierController.allPapiers}" id="carList" editable="true">  

                        <f:facet name="header">  
                            Stock Papiers 
                        </f:facet>  

                        <p:ajax event="rowEdit" listener="#{addPapierController.onEdit}" update=":msgs" />  


                        <p:column headerText="ID " style="width:125px">                                                               
                            <h:outputText value="#{car.id}" />                                                               
                        </p:column>  

                        <p:column headerText="Libéllé" style="width:125px">  
                            <p:cellEditor>  
                                <f:facet name="output">  
                                    <h:outputText value="#{car.libelle}" />  
                                </f:facet>  
                                <f:facet name="input">  
                                    <p:inputText value="#{car.libelle}" style="width:100%" label="Year"/>  
                                </f:facet>  
                            </p:cellEditor>  
                        </p:column>  

                        <p:column headerText="Type" style="width:125px">  
                            <p:cellEditor>  
                                <f:facet name="output">  
                                    <h:outputText value="#{car.type}" />  
                                </f:facet>  
                                <f:facet name="input">  
                                    <p:inputText value="#{car.type}" style="width:100%" label="Year"/>  
                                </f:facet>  
                            </p:cellEditor>  
                        </p:column>  

                        <p:column headerText="Grammage" style="width:125px">  
                            <p:cellEditor>  
                                <f:facet name="output">  
                                    <h:outputText value="#{car.grammage}" />  
                                </f:facet>  
                                <f:facet name="input">  
                                    <p:inputText id="grammage" value="#{car.grammage}" validator="#{addPapierController.validateDouble}" style="width:100%" label="Grammage"/>  
                                    <p:message for="grammage" display="icon"/>
                                </f:facet>
                            </p:cellEditor>  
                        </p:column>  

                        <p:column headerText="Format" style="width:125px">  
                            <p:cellEditor>  
                                <f:facet name="output">  
                                    <h:outputText value="#{car.format}" />  
                                </f:facet>  
                                <f:facet name="input">  
                                    <p:inputText value="#{car.format}" style="width:100%" label="Year"/>  
                                </f:facet>  
                            </p:cellEditor>  
                        </p:column>

                        <p:column headerText="Stock" style="width:125px">  
                            <p:cellEditor>  
                                <f:facet name="output">  
                                    <h:outputText value="#{car.stock}" />  
                                </f:facet>  
                                <f:facet name="input">  
                                    <p:inputText value="#{car.stock}" validator="#{addPapierController.validateDouble}" style="width:100%" label="Year"/>  
                                </f:facet>
                            </p:cellEditor>  
                        </p:column>

                        <p:column headerText="Editer" style="width:50px">  
                            <p:rowEditor />  
                        </p:column>  

                    </p:dataTable>  


                </p:fieldset>

            </ui:define>

        </ui:composition>

    </body>
</html>

in the form that contains all of this I made prependId=false, but always I have this error :

    Grave: Error Rendering View[/vues_admin/papiers.xhtml]
javax.faces.FacesException: Cannot find component with identifier ":carList:msgs" referenced from "carList".

here is the template_admin :

   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <h:outputStylesheet name="style.css" library="css" />
        <h:outputStylesheet name="styleTableExpansion.css" library="css" />
        <ui:insert name="tohead">content</ui:insert>
        <script type="text/javascript">
            function affecter_back(){
                var a = document.getElementById("menuparam")
                a.style.backgroundColor = 'white';
            }
        </script>
    </h:head>
    <h:body>

        <div id="page">
            <div id="bloc-principal">
                <h:form prependId="false" id="myform" >
                    <div id="templatemo_header_wrapper">

                        <div id="templatemo_header">

                            <div id="site_title">
                                <h1>
                                    <span>vous etes connect en tant qu' #{userController.u1.type}</span>
                                </h1>
                            </div>

                            <ul class="social_network">
                                <li><a id="ident">1dd</a></li>
                                <li><a href="login.xhtml" class="identifiant">on voie celle ci</a></li>
                                <li><a class="identifiant">#{userController.identifiant}</a></li>
                                <li><h:commandLink action="#{userController.deconnecter}"><h:graphicImage library="images" name="close.png" /></h:commandLink></li>
                            </ul>

                        </div> <!-- end of templatemo_header -->
                    </div> <!-- end of templatemo_header_wrapper -->   

                    <div id="templatemo_banner_wrapper">

                        <div id="templatemo_banner">



                        </div> <!-- end of templatemo_banner -->

                    </div> <!-- end of templatemo_banner_wrapper -->

                    <div id="templatemo_menu_wrapper">

                        <div id="templatemo_menu">
                            <ul id="menuDeroulant">
                                <li><a href="/impression/faces/vues_admin/acceuil_admin.xhtml" class="current"><span class="home">Acceuil</span></a></li>
                                <li><a href="/impression/faces/vues_admin/touslesCommandes.xhtml" class="commandes"><span class="commandes">Commandes</span></a></li>
                                <li><a href="/impression/faces/vues_admin/utilisateurs.xhtml"><span class="users">Utilisateurs</span></a></li>
                                <li><a href="/impression/faces/vues_admin/newMessage.xhtml"><span class="gallery">Message</span></a></li>
                                <li><a href="/impression/faces/vues_admin/historiqueMessages.xhtml"><span class="contact">Messages</span></a></li>
                                <li>
                                    <a id="menuparam" ><span class="contact2">Paramétres</span></a>
                                    <ul class="sousMenu">
                                        <li><a  href="/impression/faces/vues_admin/papiers.xhtml" >Stock Papiers</a></li>
                                        <li><a  href="#">Stock Reliure</a></li>
                                        <li><a  href="#">Approvisionements</a></li>
                                    </ul>

                                </li>
                            </ul>       

                        </div> <!-- end of templatemo_menu -->
                    </div> <!-- end of templatemo_menu_wrapper -->    


                    <div id="templatemo_content_wrapper">

                        <div id="templatemo_content">

                            <ui:insert name="content">content</ui:insert>
                        </div> <!-- end of templatemo_content -->
                    </div> <!-- end of templatemo_content_wrapper -->    
                </h:form>
            </div>
            <div id="templatemo_footer_wrapper">

                <div id="templatemo_footer">



                </div> <!-- end of footer -->
            </div>
        </div>

    </h:body>
</html>

do you have any idea , thanks

2

2 Answers

2
votes

I think this is related to a similar issue in MyFaces https://issues.apache.org/jira/browse/MYFACES-3607. They say this is the correct behavior, but I'm stuck with this problem too and I'll try to use ui:repeat instead of p:dataTable

0
votes

Try to change update=":msgs" to update="msgs"