1
I have the following screen:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
<ui:composition template="/layout/template.xhtml">
<ui:define name="content">
<h:form id="listaEncomendas">
<p:tabView id="viewFull">
<p:messages id="messages" showDetail="true" autoUpdate="true" closable="false" globalOnly="true" />
<p:tab title="PENDENTES">
<p:panel id="horizontal" header="Cadastrar Encomenda" toggleable="true" toggleOrientation="horizontal"
toggleTitle="Cadastrar Encomenda" collapsed="true">
<h:panelGrid id="cadastro" columns="3">
<p:outputLabel value="Código" for="codigo" />
<p:inputText id="codigo" value="#{encomendaController.encomenda.codigo}" required="true" />
<p:message for="codigo" />
<p:outputLabel value="Loja/Origem" for="loja" />
<p:selectOneMenu id="loja" value="#{encomendaController.encomenda.loja}" required="true">
<f:selectItem itemLabel="" itemValue="" />
<f:selectItems value="#{enumHelper.obterLojas()}" var="bean" itemLabel="#{bean.nome}" itemValue="#{bean.nome}" />
</p:selectOneMenu>
<p:message for="loja" />
<p:commandButton value="Cadastrar" action="#{encomendaController.salvar}" update="cadastro,:listaEncomendas:viewFull:messages" />
</h:panelGrid>
</p:panel>
<p:spacer height="10px" />
<p:dataTable id="resultadoPendentes" rows="10" paginator="true">
<p:column styleClass="botoesGrid">
<p:commandButton icon="ui-icon-pencil" />
<p:commandButton icon="ui-icon-trash" />
</p:column>
<p:column>
<f:facet name="header">
<p:outputLabel value="Código" />
</f:facet>
</p:column>
<p:column>
<f:facet name="header">
<p:outputLabel value="Situação" />
</f:facet>
</p:column>
<p:column>
<f:facet name="header">
<p:outputLabel value="Data/Hora Ocorrência" />
</f:facet>
</p:column>
<p:column>
<f:facet name="header">
<p:outputLabel value="Loja" />
</f:facet>
</p:column>
</p:dataTable>
</p:tab>
<p:tab title="ENTREGUES">
</p:tab>
<p:tab title="TODAS">
</p:tab>
</p:tabView>
</h:form>
</ui:define>
</ui:composition>
</html>
What happens is this:
My p:messages
works perfectly when it is below the p:tab
there in the update of p:commandButton
i refer you by id. But in the above scenario it doesn’t work, that is, the message is not displayed on the screen. Does anyone know if this is possible? My update is wrong ?
try putting the
<p:messages>
as the direct daughter of<h:form>
. As it is I believe that your message will never be displayed, because (if I’m not mistaken)<p:tabView>
can only have<p:tab>
as daughters.– Luídne