Hi Ibrahim thanks for the reply, but i am looking for server side validation not client side
when text entered into input box i want to display error message if that value alrdy present in db.
just like rich:validator does at client side.
What you are actually asking for (I THINK) is called bean validation.
Just for clarity, the graphValidator is for whole object validation....
For single value you want to use either the rich:validator or for bean validation just have it trigger an ajax event.
<a4j:ajax limitRender="true" immediate="true"
render="@this lCondMsgGroupId" event="change"
<rich:messages id="lCondMsgGroupId" ajaxRendered="true" for="constLCompareId"
where the value is annotated in the backing bean along the lines of:
@NotNull( message = "The compare value MUST be set!" )
@Size( min = 1, max = 50,
message = "Length must be between 1 and 50" )
private String compareValue ;
Some references are available at:
(Note, don't try to combine a validator on an input that you trigger ajax for...the ajax automatically will trigger any bean validations).
And probably you should look at BalusC's blog... he has an article that touches on it...along with a whole lot of other fun stuff!
- Greg C