JSF has a well defined lifecycle splitted in different phases that perform specific operations against the view tree. One of those phases is the PROCESS_VALIDATIONS phase which triggers the validators attached to the different UIInput components.
JasperReports JSF Plugin provides its own validation mechanism triggered at the RENDER_RESPONSE lifecycle phase. The reason to use its own mechanism is based in following observations:
The built-in validation framework is very simple and, it's also very similar to the other providers implemented within this library.
Validators are loaded used the ValidatorLoader class. The loading mechanism is based on locate inside the classpath a ValidatorFactory suitable to the current faces component.
The library provides with two built-in ValidatorFactory implementations, one for data source components and another one for report components.
Data source components are validated using a DataSourceValidator. The DataSourceValidatorFactory will look inside the classpath for classes that implement the DataSourceValidator interface. These classes must be configured the same way FillerFactory instances are. Here is an example:
:net.sf.jasperreports.jsf.validation.DataSourceValidatorBase jdbc:net.sf.jasperreports.jsf.validation.providers.JdbcDataSourceValidator
When no validator is found for the current data source type, the default one will be used. If no validator is found, the data source component will not be validated at all.
The same thing happens with reports. These are validated using a ReportValidator. The ReportValidatorFactory will look inside the classpath for classes that implement the ReportValidator interface. These classes must be configured the same way ExporterFactory instances are. Here is an example:
:net.sf.jasperreports.jsf.validation.ReportValidatorBase
When no validator is found for the current data source type, the default one will be used. If no validator is found, the data source component will not be validated at all.