Petterson Paula wrote on Feb 20, 2008 07:25 AM:
When you annotate a bean (i.e.: using @Range), when the validation fails, seam put a message in the proper field of the form. How is that accomplished?
I would like to perform validations during the execution of an action that cannot be put in a Validator, is it possible to throw some exception during the validation that will be shown at the form as a message?
Thanks in advance,
Well, you could always write a standard JSF validator (manually or through Seam) but if you look at the Hibernate Validator docs, it is hard to find stuff that can't be done with custom validators there.
you can do validation in the action method and display messages.
@In FacesMessages facesMessages;
// In your action, not important to specify correct component id facesMessages.addToControl( "serverSideForm:endDate", new FacesMessage(FacesMessage.SEVERITY_ERROR, "message summary","message details") ); return null;
Can't quite remeber if the order of the message detail/summary parameters.
There is some informatin about this here (not using seam):
Small type with severe consequences...
// In your action, not important to specify correct component id
// In your action, note important to specify correct component id