0 Replies Latest reply on Dec 1, 2011 9:51 AM by Pau aaa

    RichFaces 4.0.0.Final. JSR-303 Validation problems

    Pau aaa Newbie

      I have some concerns with the operation of the validation of RichFaces that meets the JSR-303. My application uses Spring 3.0.5, JSF 2 with Mojarra and RichFaces 4 and Hibernate 3.6.8.


      My xhtml file:


      <?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                          <rich:tabPanel id="tabPanel" selectedTab="fitxa" switchType="client" style="width:40%; margin-left:auto; margin-right:auto;">
        <rich:tab id="fitxa" name="Fitxa" rendered="#{crudBlogBean.tabFitxa}">
                                                        <h:panelGrid columns="3" style="margin-left:auto; margin-right:auto;"> 
                                                                  <h:outputLabel value="Id: " />
                                                                  <h:inputText id="id" value="#{crudBlogBean.blog.id}" ><rich:validator /></h:inputText>
                                                                  <rich:message for="id" />
                                                                  <h:outputLabel value="Nom: " />
                                                                  <h:inputText id="nom" value="#{crudBlogBean.blog.nom}"><rich:validator  /></h:inputText>
                                                                  <rich:message for="nom" />
                                                                  <h:outputLabel value="Número: " />
                                                                  <h:inputText id="numero" value="#{crudBlogBean.blog.numero}"><rich:validator /></h:inputText>
                                                                    <rich:message for="numero" />
                                                                    <a4j:commandButton execute="@region" actionListener="#{crudBlogBean.desar}" value="Acceptar" render="tabPanel" />
                                                                    <a4j:commandButton execute="@this" actionListener="#{crudBlogBean.tornar}" value="Tornar" render="tabPanel" />


      My Blog Bean:


      public class Blog {
                @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SQ_BLOG")
                @SequenceGenerator(name="SQ_BLOG", sequenceName="SQ_BLOGS", allocationSize = 1)
          private int id;
                @Size(min = 1, max = 15, message="{hola}")
          private String nom;
          private String descripcio;
          private int numero = 0;
          private List<Article> articles;
      (get and set)


      1. The validation works fine. My first question is, does the validator is instantiated by RichFaces? In my Spring configuration I have not added anything.


      2. In the example RichFaces documentation (here) at objects <rich:validator /> input is added, is it necessary?


      3. In the example above, on the onblur validation throws but does not launch in my exemple, only when I press the a4j: commandButton, why?


      4. Finally, I understand that the validator is managed by RichFaces, to change the default messages I've achieved putting in the root ValidationMessages.properties classhpath, is there any way to put that file anywhere?