Is it possible to use bean level validation provided by JSF 2.0 in JSF 1.2
Is it p开发者_运维技巧ossible to use bean level validation provided by JSF 2.0 in JSF 1.2 .
JSF 2.0 has no such thing as bean level validation. Probably you're confusing with JSR303 Bean Validation (the javax.validation
API). JSR303 is part of Java EE 6. So if you run a Java EE 6 capable container (Glassfish 3, JBoss AS 6, etc), then you'll be able to use JSR303, regardless of JSF version. Otherwise you've got to install a JSR303 implementation separately, like Hibernate Validator.
I don't know if this is what you want, but richfaces has <rich:beanValidator>
@Id
private int id;
@NotNull(message = "Company id is required")
private int companyId;
@NotNull(message = "Name is required")
private String name;
@NotNull(message = "Device resolution is required")
@Enumerated()
private DeviceResolution deviceResolution;
@NotNull(message = "Device width is required")
private int deviceWidth;
@NotNull(message = "Device height is required")
private int deviceHeight;
精彩评论