In the JSF project I'm working Exceptions thrown by Beans are usually handled by JSF redirecting the user to an error page, but when they are raised inside a Bean validation method, JSF handles them displaying in the relative <h:message>
tag the Exception message, instead.
I would like that Exceptions raised in validation methods be handled as the other Exceptions raised from Beans are. Is there a way to achieve that?
The kind of validation I'm using is through backing-bean validator method, for example in JSF page:
<h:inputText value="#{Bean.field}" validator="#{Bean.validate}" />
and, in backing bean code:
public void validate(FacesContext context, UIComponent component, Object value){
// validation logic here
}
Thanks, Andrea
javax.validation.constraints.*
annotations like@NotNull
,@Size
, etc. – BalusC<h:message>
) (2)the query raises an Exception, in this case I want to navigate to an error page (and, in case, log the Exception). – avaloriValidator
class which you attach by its ID? – BalusCValidator
classes – avalori