Issue Details (XML | Word | Printable)

Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Ed Burns
Reporter: alexsmirnov
Votes: 2
Watchers: 0

If you were logged in you would be able to see more operations.

Bean Validator support.

Created: 14/Jul/08 04:58 PM   Updated: 25/Nov/10 06:43 PM   Resolved: 24/Nov/09 07:40 AM
Component/s: Uncategorized
Affects Version/s: 2.0
Fix Version/s: 2.0

Time Tracking:
Not Specified

File Attachments: 1. Text File changebundle.txt (4 kB) 26/Mar/09 02:49 PM - Ed Burns
2. Text File changebundle.txt (2 kB) 12/Mar/09 10:49 AM - Ed Burns
3. Text File changebundle.txt (7 kB) 11/Mar/09 12:28 PM - Ed Burns
4. Text File changebundle.txt (221 kB) 26/Feb/09 09:04 AM - Ed Burns


Operating System: All
Platform: All

Issue Links:

Issuezilla Id: 426
Status Whiteboard:


Participants: alexsmirnov, Ed Burns and pmuir

 Description  « Hide

For an annotation-based validation, append "createDefaultValidator" method to an
Application object ( as far as appropriate configuration tags ).
In the base UIInput component, call validate method for a this validator in
addition to a per-component validators.
For a null- or empty values validation, call validator methods for an all
submitted values ( even for an empty or null ).

pmuir added a comment - 25/Aug/08 09:59 AM
  • JSR-303 has the concept of validation groups (such that you can apply only
    certain validations annotations)
  • it should be possible to select which group you are validating from JSF
  • There can be more than one group and a default group should be expected
    (this concept is defined in Bean Validation)
  • the group is just a string
  • you should be able to set the validation group for a group of input
    components e.g.

<f:validate groups="firstscreen">
<h:inputText id="firstname" value="#{account.firstname}" />
<h:message for="firstname" styleClass="error" />
<h:inputText id="lastname" value="#{account.lastname}" />
<h:message for="lastname" styleClass="error" />
<h:inputText id="cellPhone" value="#{account.cellPhone}" />
<h:message for="cellPhone" styleClass="error" />

- You should also be able to set the group for a single component

<h:inputText id="firstname" value="#{account.firstname}">
<f:validate groups="firstscreen" />

  • The only sane solution we could see was to validate against the actual
    populated model. This doesn't work in the current JSF lifecycle, so is probably
    beyond the scope of JSF 2
  • Note that, except for the classical password verification example, most
    cross component validation involve somewhat complex rules that are closer to
    business rules than validations. In the password case, there should be a JSF
  • Should JSR-303 validations be applied by default if a validation annotation is
    present on the property the input component's value expression binds to?
  • Yes
  • How do you disable validation?
  • Explicitly through:

<f:validator disableValidator="true">

  • All validators should be callable via Ajax
  • Client side (JS) validation with no Ajax call. This has some challenges! Some
  • The idea is to avoid any call to the server (less overhead, more responsive)
  • Validators expose some metadata about what they do (e.g. string length,
    number max value). A custom validator can expose a number of pieces of
  • Custom metadata can be exposed
  • metadata is used to attach JS validators to an input component (the
    validator applied in process validations phase may impose extra validation over
    the metadata based JS validator)
  • custom JS validators may be written which are registered and attached for an
    exposed piece of metadata (for example the validator might say it validates
    uk.postcode, in which case the JS validator for uk.postcode would be attached).
    JS validators can be registered in faces-config.xml. Kito says "This sounds like
    it should be an extension of the current validator registration, which means it
    will also be possible to use annotations. The actual JS validator should also
    reference a JSF resource."
  • How to render validation error messages. JSR-303 has a pluggable message
    resolver which can access e.g. contextual information from Web Beans. This isn't
    available on the client, so the proposal is to provide a "safe" message which is
    generated when the page is rendered. The only replacement it can make is for the
    current input value

Ed Burns added a comment - 09/Sep/08 01:44 PM


Ed Burns added a comment - 15/Oct/08 06:43 AM

Change target milestone to 2.0

Ed Burns added a comment - 26/Feb/09 09:04 AM

Created an attachment (id=203)
fix for this bug, merge from branch to trunk

Ed Burns added a comment - 11/Mar/09 12:28 PM

Created an attachment (id=214)
Change to default validator activation.

Ed Burns added a comment - 12/Mar/09 10:49 AM

Created an attachment (id=215)
reset everything back to the way it was.

Ed Burns added a comment - 26/Mar/09 02:49 PM

Created an attachment (id=221)
Fix for performance optimization to not invoke BV unless necessary

Ed Burns added a comment - 29/Jul/09 02:10 PM

take ownership

Ed Burns added a comment - 29/Jul/09 02:11 PM


Ed Burns added a comment - 24/Nov/09 07:40 AM

Prepare to delete api subcomponent