Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Valang: should <key> not always have to be a bean property? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Valang: should <key> not always have to be a bean property?

    (I guess that this is an enhancement request...)

    The valang syntax is:

    { <key> : <predicate_expression> : <message> [: <error_code> [: <args> ]] }

    The docs say:

    "...binds the rule predicates to a key (usually a bean property)"

    I have make a rule that says "either any one of these (3) fields contains data, or the 'anonymous' property == true". It looks like:

    Code:
    { firstName : ((title HAS TEXT) OR (firstName HAS TEXT) OR (surname HAS TEXT)) OR (anonymous == TRUE) : 'NAME!' : 'contactDetailsCheck.specified.title.field.required' }
    This works fine but is rather inelegant.

    My issue is that the <key> part does NOT refer to a bean property. In this case the rule refers to 4 properties.

    I'd LIKE to say:

    Code:
    { allOrPartNameGiven : ((title HAS TEXT) OR (firstName HAS TEXT) OR (surname HAS TEXT)) OR (anonymous == TRUE) : 'NAME!' : 'contactDetailsCheck.specified.name.fields.required' }
    Where 'allOrPartNameGiven' is NOT a bean property.

    At the moment, I get an exception along the lines of:

    Code:
    org.springframework.webflow.engine.ActionExecutionException: Exception thrown executing [AnnotatedAction@1dc7a0d targetAction = org.springframework.webflow.action.FormAction@19a485f, attributes = map['method' -> 'bindAndValidate']] in state 'contactDetailsCheck' of flow 'tceScriptFlow' -- action execution attributes were 'map['method' -> 'bindAndValidate']'; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'nameStuff' of bean class [au.com.sparq.tce.web.ContactDetailsCheckActionObject]: Bean property 'nameStuff' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    Caused by: 
    org.springframework.beans.NotReadablePropertyException: Invalid property 'nameStuff' of bean class [au.com.sparq.tce.web.ContactDetailsCheckActionObject]: Bean property 'nameStuff' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:510)
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:502)
    Thoughts?

    Cheers,

    Alph

  • #2
    I have this same problem. According to the documentation, the key field should be allowed to be any value, not just a bean field name, but I get an error saying that the Bean property is not readable or has no getter.

    I need to highlight specific field errors on the field that caused the error, so this is a problem for "generic" errors that don't apply to any one field in particular.

    One workaround is to use any non-displayed field in the bean as the key value, but I'd really like to be able to just use a dummy key name so the error does not bind to any particular field.

    Comment

    Working...
    X