Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure, but this all look like unnecessarily overcomplicated. To change icons/styles based on the message severity, just make use of the CSS powers. You can specify different CSS classes based on message severity using <code>infoClass</code> and <code>errorClass</code> attributes of the <code>&lt;h:messages&gt;</code> and you can specify the icons as CSS background image.</p> <p>JSF:</p> <pre><code>&lt;h:messages id="messages" layout="table" infoClass="info" errorClass="error" /&gt; </code></pre> <p>CSS:</p> <pre><code>#messages .info td { background: url('info.gif') no-repeat left center; padding-left: 15px; } #messages .error td { background: url('error.gif') no-repeat left center; padding-left: 15px; } </code></pre> <p>The <code>&lt;h:messages layout="table"&gt;</code> itself already renders a HTML <code>&lt;table&gt;</code>. I think the whole table around it is unnecessary as well. Just apply styles accordingly the usual CSS way.</p> <pre><code>#messages { width: 375px; margin: 0 auto; border: 1px black solid; border-collapse: collapse; } </code></pre> <h3>See also:</h3> <ul> <li><a href="http://www.w3schools.com/css/" rel="noreferrer">W3schools CSS tutorial/reference</a></li> <li><a href="http://www.csstutorial.net/" rel="noreferrer">CSStutorial.net CSS tutorial</a></li> </ul> <hr> <p><strong>Update</strong>: as per the comments, you're looking for something like this:</p> <pre><code>&lt;h:messages layout="table" styleClass="messages info" infoClass="info" errorClass="error" /&gt; &lt;h:messages layout="table" styleClass="messages error" infoClass="info" errorClass="error" /&gt; </code></pre> <p>with CSS:</p> <pre><code>.messages { width: 375px; margin: 0 auto; border-collapse: collapse; border: 1px black solid; } .messages.info { background: url('info.gif') no-repeat left center; } .messages.error { background: url('error.gif') no-repeat left center; } .messages.info tr.error, .messages.error tr.info { display: none; } .messages td { padding-left: 15px; } </code></pre> <p>This shows two separate message tables, one for <code>info</code> and other for <code>error</code> messages, each with a single icon on the left center.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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