myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "Extensions/Validator/ExtVal and Spring" by GerhardPetracek
Date Sat, 01 Nov 2008 18:43:50 GMT
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.

Mime
View raw message