2 Replies Latest reply on Mar 22, 2013 8:46 AM by giunad

    rich:message vs h:message

    giunad

      hi everybody

       

      I'm new to validation and I'm making some tests.

       

      here is my page:

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

          xmlns:s="http://jboss.com/products/seam/taglib"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:a="http://richfaces.org/a4j"

          xmlns:rich="http://richfaces.org/rich"

          template="templates/mainT.xhtml">

       

          <ui:define name="body">

       

          <h:form id="user_form">

              <h:outputLabel id="labForLog" for="login">Login</h:outputLabel>

              <h:inputText value="#{employee.login}" required="true" id="login" immediate="true" styleClass="text">

                  <s:validate />

                  <a:support event="onblur" ajaxSingle="true" bypassUpdates="true" eventsQueue="loginkeyup" ignoreDupResponses="true" />

              </h:inputText>

              <h:message for="login" />

              <h:commandButton id="btnCreate" value="create" action="#{employee.doInsert}" styleClass="create_account" image="images/create_account.jpg" />

       

          </h:form>

       

          </ui:define>

      </ui:composition>

       

      and in employee java, login is so defined:

       

      @NotNull

      @Length(min=6, max=10, message="La lunghezza deve essere tra {min} e {max}")

      @Pattern(regex="[a-zA-Z0-9]*", message="Puoi usare solo lettere e numeri")

      @UniqueEntity(targetEntity="Account", field="login", message="Login non disponibile")

      private String login;

       

      what I get is that if I use h:message no message is showed, while rich:message works great.

       

      why? any idea?

      I don't want use richfaces just for an error message.

       

      thanks