6 Replies Latest reply on Jun 20, 2006 6:24 AM by Gavin King

    Component Message Problem

    W Brian Leonard Newbie

      I've taken your sample registration application and added HtmlMessages for each of the 3 input fields:

       <table border="0">
       <tr>
       <td>Username</td>
       <td><h:inputText id="userName" value="#{user.username}"/> <h:message for="userName"/></td>
       </tr>
       <tr>
       <td>Real Name</td>
       <td><h:inputText id="name" value="#{user.name}"/> <h:message for="name"/></td>
       </tr>
       <tr>
       <td>Password</td>
       <td><h:inputSecret id="password" value="#{user.password}"/> <h:message for="password"/></td>
       </tr>
       </table>
       <h:messages globalOnly="true"/>
      


      If you enter a password less than 5 characters, the message appears next to the component as expected. However, if you enter a username less than 5 characters, the message appears in the global messages component. I've spent the last couple of hours trying to figure out the difference, but alas, I surrender to you guys.

      I'm using JBoss 4.0.4 GA and Seam 1.0.0CR3

      Thanks,
      Brian

        • 1. Re: Component Message Problem
          Gavin King Master

          Change the id from "userName" to "username".

          Actually this is a bug, that I will fix.

          • 2. Re: Component Message Problem
            Gavin King Master

            oh, hold on, it looks like you are using an olde version of the registration example. This problem does not occur if you use s:vaidate or s:validateAll instead of @IfInvalid.

            • 3. Re: Component Message Problem
              W Brian Leonard Newbie

              Well, if you consider 1.0.0CR3 old, then yes. I just downloaded the cvs head, and it doesn't appear that the @NotNull constraint is being caught by the s:validateAll tag as I'm getting the following exception:

              javax.faces.FacesException: Error calling action method of component with id _id0:_id6
               at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
              ...
              
              Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{register.register}
               at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
              ...
              ...
              ...
              Caused by: org.hibernate.validator.InvalidStateException: validation failed for: org.jboss.seam.example.registration.User
               at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:104)
              


              This is running the unmodified version of the Registration example that ships with the source. I guess as a work around for now, I can set the required property to true on the component.

              Regards,
              Brian



              • 4. Re: Component Message Problem
                Gavin King Master

                Ooops, I forgot the required="true" on the input fields.

                You need this, a JSF validator (somewhat bizarrely) cannot be used to validate null-ness.

                • 5. Re: Component Message Problem
                  Kevin Simons Newbie

                  I've got the updated registration example (with required="true" on the input fields) and I'm still getting the exception described by Brian:

                  javax.faces.FacesException: Error calling action method of component with id _id0:_id9
                   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
                   ...
                  Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{register.register}
                   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
                   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
                   ...
                  Caused by: javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
                   at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
                   ...
                  Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
                   at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:128)
                   ...
                  Caused by: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
                   at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:37)
                   ...
                  


                  I'm using a brand new download of JBoss 4.0.4 GA and I just download SEAM yesterday (June 19).

                  • 6. Re: Component Message Problem
                    Gavin King Master

                    You need EJB 3.0 RC8.

                    Or install JBoss with the "JEMS Installer".

                    This is doc'd in the getting started guide and in the announcements above.