Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should apply this in the client side instead. You've got a collection of client IDs with messages. One of the ways is to pass this information to JavaScript and let it do the job. You can find an example of such a <code>PhaseListener</code> in this article: <a href="http://balusc.blogspot.com/2007/12/set-focus-in-jsf.html" rel="nofollow noreferrer">Set focus and highlight in JSF</a>.</p> <p>Since JSF 2.0 there is however another way without the need for a <code>PhaseListener</code>. There's a new implicit EL variable, <code>#{component}</code> which refers to the <a href="http://download.oracle.com/javaee/6/api/javax/faces/component/UIComponent.html" rel="nofollow noreferrer"><code>UIComponent</code></a> instance of the current component. In case of <a href="http://docs.oracle.com/javaee/6/api/javax/faces/component/UIInput.html" rel="nofollow noreferrer"><code>UIInput</code></a> components, there's an <a href="http://docs.oracle.com/javaee/6/api/javax/faces/component/UIInput.html#isValid%28%29" rel="nofollow noreferrer"><code>isValid()</code></a> method. This allows you to do something like:</p> <pre class="lang-html prettyprint-override"><code>&lt;h:inputText styleClass="#{component.valid ? '' : 'error'}" /&gt; </code></pre> <p>with this in a CSS file:</p> <pre><code>.error { background: #ffe1e1; } </code></pre> <p><em>(yes, you can also do this in a <code>style</code> attribute, but mingling style with markup is a poor practice)</em></p> <p>To abstract this away (so that you don't need to repeat it in every input), you can just create a <a href="https://stackoverflow.com/tags/composite-component/info">composite component</a> for this, something like <code>&lt;my:input&gt;</code>.</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