extval bean验证xml映射

时间:2014-03-21 15:05:31

标签: java validation jsf bean-validation hibernate-validator

我尝试使用基于xml验证的extval,但它不起作用。它基于注释工作正常。如果我使用任何本机JSR 303验证或hibernate验证,xml验证工作正常。是不是基于xml的extval支持valdaition? 。 这是我的配置 validation.xml

<?xml version="1.0" encoding="UTF-8"?>
<validation-config
    xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration">
    <constraint-mapping>META-INF/constraints-login.xml</constraint-mapping>
</validation-config>

约束-login.xml

<?xml version="1.0" encoding="UTF-8"?>
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
    xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
    <default-package>com.beans</default-package>
    <bean class="LoginBean" ignore-annotations="false">
        <field name="userName">
            <constraint annotation="org.apache.myfaces.extensions.validator.baseval.annotation.Required"/>
        </field>
    </bean>
</constraint-mappings>

0 个答案:

没有答案