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
validations for optional fields using BVF Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • validations for optional fields using BVF


    With Bean Validation Framework 0.9, how can we validate fields which are not mandatory? For example in a form, middle name is optional but when entered, it should not contain any special characters. Similary email. The email field in a form can be option but when a value is entered it must match the rule "email"

    <property name="email">
           <email />
    With above code in the validation.xml, an error message is being shown to enter the email address even though it is optional. I tried to use the length and apply-if conditions in addition, but it did not work.

    Could you help me out in this regard please?

    thanks in advance,