Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I know it's been a while, but thought to share this alternate solution for the benefit of others. For composites, create a backing component with a getter, then iterate over the faces messages and call remove() after collecting each message. This will get you around the "messages queued" warning without the h:messages hack. </p> <p>xhtml:</p> <pre><code>&lt;composite:interface displayName="Messages Component" shortDescription="Messages Component" componentType="com.company.dept.commons.ui.messages.Messages"&gt; &lt;composite:attribute name="styleClass" default="" type="java.lang.String" shortDescription="CSS style class for the component" /&gt; &lt;/composite:interface&gt; &lt;composite:implementation&gt; &lt;div id="messagesComponent" class="#{cc.attrs.styleClass}"&gt; &lt;ui:repeat value="#{cc.messageList}" var="message"&gt; #{message.severity} - #{message.detail}&lt;br/&gt; &lt;/ui:repeat&gt; &lt;/div&gt; &lt;/composite:implementation&gt; </code></pre> <p>Backing component:</p> <pre><code>@FacesComponent("com.company.dept.commons.ui.messages.Messages") public class Messages extends UINamingContainer { private List&lt;FacesMessage&gt; messages; public List&lt;FacesMessage&gt; getMessageList() { //preserve messages in case getter is called multiple times if (messages == null) { messages = new ArrayList&lt;FacesMessage&gt;(); } Iterator&lt;FacesMessage&gt; messageItr = getFacesContext().getMessages(); while(messageItr.hasNext()) { FacesMessage message = messageItr.next(); messages.add(message); messageItr.remove(); } return messages; } } </code></pre> <p>Note the componentType in the xhtml is set to the FacesComponent value in the code. Also, the reference to cc.messageList will trigger the call to getMessageList().</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload