1

I'm working in a Java EE web application using Hibernate, Spring, JSF and Primefaces.

My Question is how can I control the UI components (jsf and primefaces components) using POJO annotations.
Is there any framework I can add to my project to do this?

example :

class user {
   @NotNull @Max=100
   public String name;
}

The UI component associated with the name attribut must validate the string entred (not null and not exceding 100 char.)

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
faissal
  • 261
  • 5
  • 20

1 Answers1

1

This is called bean validation, also known as JSR-303. The reference implementation is the Hibernate Validator. This is already bundled in every Java EE 6 application server complying the web profile, such as Glassfish 3, JBoss AS 6/7, etc. This is not bundled in barebones JSP/Servlet containers such as Tomcat, Jetty, etc. If you target those containers, you'd need to download the bean validation libraries and drop in webapp's /WEB-INF/lib yourself.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555