iScreen 2.0.0: Reporting Validation Failures
iScreen is a Java object validation framework, which means it is designed to validate full object-graphs. Based upon a powerful and flexible XML configuration, developers concentrate on configuring their validations, rather than coding them.
This new release adds several new features related to reporting validation failures. Failures can now have arbitrary severity levels, multiple failure messages, and a better tracing capability. A new conditional was added to individual validator use, which means that you can use logic to determine whether to execute a validator or not. Both OGNL and MVEL are supported expressions languages.
Here's an example of using the new 'if' attribute on the 'use-validator' element, and multiple messages associated with a failure (as well as defining a severity level on a failure).
<validation-set id="validateMyObject">
...
<use-validator ref="MyStringValidator" if="bean. someProp != null" />
</validation-set>
<validator id="MyStringValidator" ref="org.iscreen.StringValidator">
...
<failure property="minLengthFailure" key="minLengthMessage" severity="warning">
<msg name="action" key="minLengthActionMessage" />
<msg name="log_message" key="minLengthLogMessage" />
</failure>
</validator>
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)





Comments
Fabian Crabus replied on Tue, 2008/07/01 - 8:19am
Are you planning to support JSR-303?
It'd be nice to test your framework as a drop in replacement for agimatec validation
Fabian
Dan Shellman replied on Tue, 2008/07/01 - 8:52am
in response to:
Fabian Crabus
I have no current plans to implement JSR-303, given that it's an annotation-based validation approach, and iScreen is an XML-based (or, more specifically, configuration-based) validation framework. I've not been convinced that the use of annotations is an appropriate way to do validation. It's good for fairly basic validations, but am concerned that it doesn't support more complex scenarios.