spring mvc 4 validation配(pei)置

行業動(dòng)态 公(gōng)司新(xin)聞 案例分(fēn)享 技(ji)術(shù)百(bai)科(ke)

spring mvc 4 validation配(pei)置

來源:奇站網絡 浏覽量:2,183 髮(fa)布日(ri)期: 2017-10-17

  1. <bean id="customerBinding" class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
  2. <property name="validator" ref="validator">
  3. </property>
  4. </bean>
  5. <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
  6. <property name="providerClass" value="org.hibernate.validator.HibernateValidator"
  7. />
  8. <!--不設(shè)置則默認爲(wei)classpath下的(de) ValidationMessages.properties -->
  9. <property name="validationMessageSource" ref="validatemessageSource" />
  10. </bean>
  11. <bean id="validatemessageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
  12. <property name="basename" value="classpath:validatemessages" />
  13. <property name="fileEncodings" value="utf-8" />
  14. <property name="cacheSeconds" value="120" />
  15. </bean>

參考資(zi)料:
http://www.cnblogs.com/whgk/p/7191152.html
https://my.oschina.net/shyloveliyi/blog/525252

标簽:

廈們(men)奇站網絡科(ke)技(ji)有(yǒu)限(xian)公(gōng)司

電(dian)話(hua):13313868605

QQ:3413772931

地阯(zhi):廈們(men)集(ji)美區(qu)軟件園三期


                    掃一(yi)掃加(jia)我(wo)咨詢