beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djkuul <dhwa...@hotmail.com>
Subject Re: Validating indexed properties, nested properties...
Date Tue, 22 Apr 2008 00:02:52 GMT

Thanks Carlin, Nested properties do work.

Indexed properties did not work, and hence neither do nested indexed
properties (which I am really intrested in).
Databinding in jsp is not a problem for indexed properties since we can
easily do so using one of the 
netui-data tags such as repeater or data grid and then use the container
implicit variable. But no 'iterating' facility is present when we want to do
the validation using the validation annotations.

What can be the best possible workaround?

Thanks,
Dj


Carlin Rogers-2 wrote:
> 
> 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.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Validating-indexed-properties%2C-nested-properties...-tp16765604p16818571.html
Sent from the Beehive - User mailing list archive at Nabble.com.


Mime
View raw message