Bean Validation Messages in JSF 2

Posted by: Rossen Stoyanchev on 2010-10-03 03:41:00.0
JSF 2 introduced support for standard JSR-303 Bean Validation. One of the surprising bits was the default error messages.
Suppose I added an annotation to one of my form beans as follows:

public class Booking {

@NotEmpty
private String creditCardName;

}

and then I bind it to a form input field:


<h:messages />

<h:inputText label="Credit [...]
be the first to rate this blog

About Rossen Stoyanchev

Rossen Stoyanchev

Rossen began work as a consultant and trainer for SpringSource in 2007 with a focus on Spring Web technologies. In 2010 he accepted his new role as a SpringSource/VMWare software engineer leading Spring Web Flow 2 development efforts. Rossen has been developing software professionally for over 15 years, is currently based in London, and enjoys tennis and swimming whenever he is not programming.

More About Rossen »

NFJS, the Magazine

2010-09-01 00:00:00.0 Issue Now Available
  • Gradle - The Groovy Way To Build
    by Ken Sipe
  • Top Five Ways to Improve Your Java by Adding Groovy
    by Kenneth Kousen
  • Javascript for Grails Developers
    by Dave Klein
  • Practical DSLs in Groovy
    by Peter Bell
Learn More »