Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

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.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
validation: Valang global errors Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • validation: Valang global errors

    Hi everybody, I'm trying valang and I really like it. I have one little problem I couldn't figure out how to solve it.
    I have this validator:

    <bean id="pagoValidatorValang" class="org.springmodules.validation.valang.ValangV alidator">
    <property name="valang">
    { global : [T<d+12H]>=[T] : 'No se pueden realizar operaciones de pago después del mediodía'}
    { codigoPagoElectronico : ? is not blank : 'El codigoPagoElectronico no puede ser vacío' : 'errores.codigo_pe_vacio' }
    { codigoPagoElectronico : ? is blank or length(?) > 2 : 'El codigoPagoElectronico debe tener mayor longitud'}

    the 2 last rules are specific for the field 'codigoPagoElectronico' and it works perfect, but I want the first rule to be global, not attached to any field of the command being validated.
    It works at frontend, with the generated javascript, it seems that if valang doesn't find a field that matchs the rule key it assumes it's a global. But if I disable js and the backend validator does the validation, I'm getting this ugly (but expected) error:

    GRAVE: Servlet.service() para servlet spring lanzó excepción
    org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'global' of bean class [net.technisys.defaultapp.beans.Pago]: Bean property 'global' 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.getPrope rtyValue(
    at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(
    at org.springframework.validation.AbstractPropertyBin dingResult.getActualFieldValue(AbstractPropertyBin

    Any ideas?

    Thanks in advance


  • #2
    Same problem. How do I indicate a global error using Valang? Unfortunatelly I didn't find a note in the reference documentation.