Spring validations default messages

梦想的初衷 提交于 2019-12-03 21:28:14

Try this in you Spring context instead:

<bean id="messageSource"
    class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basename" value="WEB-INF/classes/messages" />
</bean>

Then inside "WEB-INF/classes" folder create a file call: "messages.properties"

Take note for the content of "messages.properties" you have to provide it like this :

typeMismatch.pathValueInsideYourJSPform:input= Your Message 

Hope this helps you !

here is a sample also

Try specifying the complete path and try

    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
      <property name="basename" value="WEB-INF/messages" />
    </bean>
Jeremy

Apparently I have to run the FieldError objects through the Spring MessageSource. I was hoping this was done automatically. I found my answer here:

How to get error text in controller from BindingResult

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!