Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display the appropriate message (info or warn) in s:decorate?
    primarykey
    data
    text
    <p>I am actually checking for availability of a login name and would like to show the info image or warn image with an appropriate message. Currently we get 2 error messages on non availability of a login name. </p> <pre><code> &lt;s:decorate id="loginIdField" template="/layout/edit.xhtml"&gt; &lt;ui:define name="label"&gt;Desired Login Name&lt;/ui:define&gt; &lt;a:region&gt; &lt;h:inputText id="loginId" required="true" value="#{userHome.instance.loginId}"/&gt; &lt;s:message warnStyle="color: red" infoStyle="color: green"/&gt; &lt;div class="actionButtons"&gt; &lt;a:commandButton id="submit" value="Check Availability" action="#{userHome.isUnique(userHome.instance.loginId)}" reRender="loginIdField"/&gt; &lt;/div&gt; &lt;/a:region&gt; &lt;/s:decorate&gt; </code></pre> <p>Code to add appropriate messages in the bean.</p> <pre><code> if (!unique) { statusMessages .addToControlFromResourceBundle( "loginId", WARN, "LoginIdNotUnique", new Object[] { inputLoginId }); } else { statusMessages.addToControlFromResourceBundle("loginId", INFO, "LoginIdUnique", new Object[] { inputLoginId }); } </code></pre> <p>edit.xhtml</p> <pre><code>&lt;ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:s="http://jboss.com/products/seam/taglib"&gt; &lt;div class="prop"&gt; &lt;s:label styleClass="name #{invalid?'errors':''}"&gt; &lt;ui:insert name="label"/&gt; &lt;s:span styleClass="required" rendered="#{required}"&gt;*&lt;/s:span&gt; &lt;/s:label&gt; &lt;div style="clear: both"/&gt; &lt;span class="value #{invalid?'errors':''}"&gt; &lt;s:validateAll&gt; &lt;ui:insert/&gt; &lt;/s:validateAll&gt; &lt;/span&gt; &lt;span class="error"&gt; &lt;h:graphicImage value="/img/error.gif" rendered="#{invalid}" styleClass="errors"/&gt; &lt;s:message styleClass="errors"/&gt; &lt;/span&gt; &lt;/div&gt; &lt;/ui:composition&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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