Java Reference
In-Depth Information
By utilizing group conversion, you can achieve the full potential of validation groups. This allows applications to
become more versatile and also enhances the validation of application objects since it allows for finer-grained control.
Message Interpolation via EL
The Bean Validation 1.1 release has made validation messaging much more flexible via the use of messaging within
the unified expression language (EL). A formatter object and the validation values are now injected into the EL
context, allowing nicely formatted messages to be made available for use within an application's views.
For example, suppose that you wished to print an error message if a @NotNull constraint was violated.
It is possible to embed the EL within the error message, as in the following excerpt:
@NotNull(message="The message is dated ${today}, and the username should not be null")
@Size(min=8, groups=Authentication.class)
private String username;
A Truly Open API
Bean Validation 1.1 is an open source API. That is, the web site ( ) sources, discussions,
and work are all performed in the open. As such, not only is the API tied into Java EE 7, but it can also be used with
many other technologies outside of Java EE. Anyone can join the mailing lists and get involved in working with Bean
Validation, if interested.
In the early days of web applications, one had to utilize a combination of JavaScript and server-side logic in order to
validate data being entered into a web form. Applications using that kind of validation were difficult to develop and
maintain because one had to jump back and forth between JavaScript, Java, and HTML, while paying careful attention
to the DOM to ensure that everything was being referenced properly. Bean validation aims to make it easier to apply
validation to applications by moving validation logic into the server-side bean and getting rid of the cumbersome
JavaScript technique. The release of Bean Validation 1.1 makes this API even more robust, adding features such as CDI
integration and method validation.
Search WWH ::

Custom Search