我的更新属性有问题,我想更新数据表之外的标记,但总是有一个错误,这是我的 xhtml 页面:
<?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>
在包含所有这些的表单中,我做了 prependId=false,但我总是有这个错误:
Grave: Error Rendering View[/vues_admin/papiers.xhtml]
javax.faces.FacesException: Cannot find component with identifier ":carList:msgs" referenced from "carList".
这是 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>
你有什么想法吗,谢谢