使 GWT 验证工作
Making GWT Validation work
我有一个可用的 Errai GWT 应用程序(GWT 版本:2.5.1,Errai 版本:3.0。0.Final),只需在 gwt.xml 中添加 Errai 验证(在将其依赖项添加到POM):
<inherits name="org.hibernate.validator.HibernateValidator" />
<inherits name="org.jboss.errai.validation.Validation" />
引发此错误:
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[ERROR] Errors in '/tmp/gwt-codeserver-2599039351007089711.tmp/com.myapp.App/compile-1/gen/org/jboss/errai/validation/client/ValidatorFactoryImpl.java'
[ERROR] Line 9: The value for annotation attribute GwtValidation.groups must be an array initializer
[ERROR] Line 9: The value for annotation attribute GwtValidation.value must be an array initializer
See snapshot: /tmp/org.jboss.errai.validation.client.ValidatorFactoryImpl2638227711022430113.java
[ERROR] Errors in 'com/google/gwt/validation/client/spi/GwtValidationProvider.java'
[ERROR] Line 38: Rebind result 'org.jboss.errai.validation.client.ValidatorFactoryImpl' could not be found
[ERROR] Compiler returned false
我认为您混合了 "native" GWT 验证和 Errai 验证,并且 GWT 验证仅适用于 hibernate-validator-4.1.0。
使用 Errai,您不必创建自己的 ValidationFactory,只需 @Inject 验证器即可。
我有一个可用的 Errai GWT 应用程序(GWT 版本:2.5.1,Errai 版本:3.0。0.Final),只需在 gwt.xml 中添加 Errai 验证(在将其依赖项添加到POM):
<inherits name="org.hibernate.validator.HibernateValidator" />
<inherits name="org.jboss.errai.validation.Validation" />
引发此错误:
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[ERROR] Errors in '/tmp/gwt-codeserver-2599039351007089711.tmp/com.myapp.App/compile-1/gen/org/jboss/errai/validation/client/ValidatorFactoryImpl.java'
[ERROR] Line 9: The value for annotation attribute GwtValidation.groups must be an array initializer
[ERROR] Line 9: The value for annotation attribute GwtValidation.value must be an array initializer
See snapshot: /tmp/org.jboss.errai.validation.client.ValidatorFactoryImpl2638227711022430113.java
[ERROR] Errors in 'com/google/gwt/validation/client/spi/GwtValidationProvider.java'
[ERROR] Line 38: Rebind result 'org.jboss.errai.validation.client.ValidatorFactoryImpl' could not be found
[ERROR] Compiler returned false
我认为您混合了 "native" GWT 验证和 Errai 验证,并且 GWT 验证仅适用于 hibernate-validator-4.1.0。
使用 Errai,您不必创建自己的 ValidationFactory,只需 @Inject 验证器即可。