I implemented a custom c开发者_开发百科lass level validator in my seam/hibernate application. On my form I have <s:validateAll>
. This tag does not call the class level validation.
Related issue: https://jira.jboss.org/browse/JBSEAM-1878
What is the best way for me to call this validation using Seam/JSF/RichFaces?
Have you used the validator
attribute? You have to use that together with either s:validateAll
or s:validate
This is maybe not what you mean by hibernate class level validation, but at least it will work
For instance:
<h:inputText value="#{foo.bar}" validator="#{validator.checkFoo}" required="true">
<s:validate/>
</h:inputText>
And validator
@Name("validator")
@Scope(ScopeType.EVENT)
@BypassInterceptors
public class Validator {
public void checkFoo(FacesContext context, UIComponent toValidate, Object value) {
//Do some check and if incorrect set this value
((UIInput) toValidate).setValid(false);
}
}
精彩评论