beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlin Rogers" <carlin.rog...@gmail.com>
Subject Re: Validating indexed properties, nested properties...
Date Mon, 21 Apr 2008 16:09:15 GMT
I haven't tested indexed properties but do know that nested properties
work. To set up declarative validation to validate the properties of a
nested form bean, the propertyName in the validation is given as
something like "address.street". For example, it might look like...

    @Jpf.Action(
        useFormBean = "_formOne",
        validatableProperties = {
            @Jpf.ValidatableProperty(
                propertyName = "name",
                validateMinLength =
                    @Jpf.ValidateMinLength(
                        chars = 2,
                        message = "Name must be 2 chars"
                    )
            ),
            @Jpf.ValidatableProperty(
                propertyName = "address.street",
                validateMinLength =
                    @Jpf.ValidateMinLength(
                        chars = 5,
                        message = "Street must be 5 chars"
                    )
            ),
            @Jpf.ValidatableProperty(
                propertyName = "address.state",
                validateMinLength =
                    @Jpf.ValidateMinLength(
                        chars = 2,
                        message = "State abbreviation must be 2 chars"
                    ),
                validateMaxLength =
                    @Jpf.ValidateMaxLength(
                        chars = 2,
                        message = "State abbreviation must be 2 chars"
                    )
            )

And the corresponding JSP would have a dataSource for the same
"address.street", etc...

  Name: <netui:textBox dataSource="actionForm.name" /><br />
  Street: <netui:textBox dataSource="actionForm.address.street" /><br />
  State: <netui:textBox dataSource="actionForm.address.state" /><br />

Kind regards,
Carlin


On Fri, Apr 18, 2008 at 4:10 PM, djkuul <dhwajad@hotmail.com> wrote:
>
>  One more question regarding validations-
>
>  How to validate indexed properties, nested properties and mapped properties?
>  Can this be done without writing a custom validator? Essentially I would
>  like to use the existing validation annotations like the
>  Jpf.ValidateRequired, Jpf.ValidateEmail etc. but on indexed and nested
>  properties of an Action Form.
>
>  Thanks.
>  --
>  View this message in context: http://www.nabble.com/Validating-indexed-properties%2C-nested-properties...-tp16765604p16765604.html
>  Sent from the Beehive - User mailing list archive at Nabble.com.
>
>

Mime
View raw message