You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2008/11/01 19:43:50 UTC
[Myfaces Wiki] Update of "Extensions/Validator/ExtVal and Spring" by
GerhardPetracek
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The following page has been changed by GerhardPetracek:
http://wiki.apache.org/myfaces/Extensions/Validator/ExtVal_and_Spring
New page:
= Spring Support of ExtVal =
It's possible to provide a validation strategy as Spring bean.
Use-cases:
* Inject a Spring bean into the validation strategy
* AOP exception handling
* ...
{{{
//The name of annotation: @CustomRequired
//Part of the Spring configuration:
<bean id="customRequiredValidationStrategy" class="..." lazy-init="true">
<property name="messageResolver" ref="customMsgResolver"/>
<property name="requiredValidationService" ref="demoRequiredValidationService"/>
</bean>
<bean id="customMsgResolver" class="org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultValidationErrorMessageResolver" lazy-init="true">
<!-- With JSF 1.2 you can use the var name of resource-bundle see faces-config.xml -->
<property name="messageBundleVarName" value="messages"/>
</bean>
<bean id="demoRequiredValidationService" class="..."/>
}}}
The bean name follows the available name conventions.[[BR]]
(Also custom name conventions are supported.)
A simple demo is available here:
[http://code.google.com/p/os890/source/browse/#svn/trunk/java/web/jsf/extval/examples/advanced/demo_106 demo_106]
Furthermore, it's possible to provide a Meta-Data Transformer as Spring bean.