This content has been marked as final.
Show 1 reply
-
1. Re: Validator in Bean
valtoni Jul 26, 2007 10:56 AM (in response to demetrio812)"demetrio812" wrote:
Hi,public void validaEmailNewsletter(FacesContext context, UIComponent toValidate, Object value) { if (isEmailInserita((String)value)) { // se c'è già FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Attenzione: l'indirizzo email è già stato registrato", "Attenzione: l'indirizzo email è già stato registrato"); throw new ValidatorException(message); } }
Demetrio, don't use throws in methods exposed in Seam context session: jsf catch this exception and the enviroment will catch this, showing the page error wich you post here. You must throw exception like a "Blog Application", wich come with seam distribution; you must declare the Throwable class, like the example:@ApplicationException(rollback=true) @HttpError(errorCode=HttpServletResponse.SC_NOT_FOUND) public class EntryNotFoundException extends Exception { EntryNotFoundException(String id) { super("entry not found: " + id); } }
and mark your method likepublic void validaEmailNewsletter(FacesContext context, UIComponent toValidate, Object value) throws EntryNotFoundException
And demark your right annotations to be rightly redirected. Ok?