If you are using JSR 303 validation annotation , then you can define messgae source . hope below example will help you ..
to define message source
Code:
@Bean
public ResourceBundleMessageSource messageSource(){
ResourceBundleMessageSource rs = new ResourceBundleMessageSource();
rs.setBasenames("com.american.cst.resource.errorMsg","com.american.cst.resource.label");
return rs;
}
backing bean validation annotation
Code:
@NotEmpty
@Size(max=40)
private String userName ;
@NotEmpty
@Size(max=40)
private String password ;
property file which contain messages
Code:
#login page related messages
NotEmpty.userDetail.userName = User Name Should Not Be Empty
NotEmpty.userDetail.password = Password Should Not Be Empty