On my form I would like to have main messages like 'System ' displayed across the top and I would like messages regarding field displayed only next to the field. The field messages are displaying next to the field and on the top. I found a way to fix this but I was hoping there is an easier way. I fixed it by setting
<p:messages id="msgs" showDetail="true" showSummary="false" rendered="#{create.renderMessage}"/>
and passing in true or false to specify when it should and should not render.
Let me know if I coded something wrong and there is an easier way, or is this just how Messages / Message works?
Code: Select all
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
template="/templates/BoxLayout.xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:f="http://java.sun.com/jsf/core">
<ui:define name="center">
<p:ajaxStatus style="height:19px;width:220px">
<f:facet name="start">
<h:graphicImage value="/resources/images/ajax-loader.gif" />
<!--<h:graphicImage value="#{request.contextPath}/faces/resources/images/ajax-loader.gif" />-->
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
<h:form prependId="false">
<h:panelGrid id="errGrid" columns="1">
<p:messages id="msgs" showDetail="true" showSummary="false"/>
</h:panelGrid>
</h:form>
<h:form prependId="false">
<h:panelGrid id="grid" columns="3">
<h:outputText value="Manufacturer" />
<h:inputText id="manufacturer" value="#{create.manufacturer}" required="true"/>
<p:message for="manufacturer"/>
<h:outputText value="Serial Number"/>
<h:inputText id="serialNumber" value="#{create.serialNumber}" required="true"/>
<p:message for="serialNumber"/>
<h:outputText value="Part Number" />
<h:inputText id="partNumber" value="#{create.partNumber}" required="true"/>
<p:message for="partNumber"/>
</h:panelGrid>
<p:commandButton value="Submit" action="#{create.createBox}" update="grid,errGrid"/>
</h:form>
</ui:define>
</ui:composition>