4 Replies Latest reply on May 22, 2008 7:57 PM by chris.simons

    Problem with @NotNull

    pancor

      I'm having problems with tag @NotNull; if i don't specify the tag required=true  in the inputText field in jsf and use only the annotation on a property of the backing bean, the validation doesn't work. Does someone know the solution ?

        • 1. Re: Problem with @NotNull
          graben

          It's not a problem of @NotNull. This behavior belongs to JSF. If the inputText component is empty the validation is not executed. that is why the notnull validator seems to do not work. required=true is absolutely necessary to use. Another solution is to manually check the field in the managed bean.

          • 2. Re: Problem with @NotNull
            haefti

            I'm facing the same problem but I did not know whether this is a SEAM or a general JSF problem.


            The behaviour is pretty awful because none of the Hibernate validators seem to work on empty strings. For example you can use @Length(min = 2) which does nothing on an empty string but fires the right message if you enter only one character.

            • 3. Re: Problem with @NotNull
              www.supernovasoftware.com

              I am curious why JSF was ever designed to work this way.


              Anyone know?

              • 4. Re: Problem with @NotNull

                A very good question.


                This problem also affects the @Email (albeit, this is a part of Seam) annotation.  Though I think the Seam devs are working on a fix for this particular problem.


                Jason - are you the same Jason who put together the awesome Seam on OC4J 10.1.3 blog?