开发者

ScriptAssert.List message from messages.properties

I have

@ScriptAssert.List({
    @ScriptAssert(lang="javascript",script="_this.email.equals(_this.confirmEmail)",message="email no match"),
    @ScriptAssert(lang="javascript",script="_this.password.equal开发者_如何转开发s(_this.confirmPassword)",  message="password no match")

I want to load the message from messages.properties , I success doing this with

ScriptAssert.signupBean=WORKING

which works , but it's for both cases , how I can seperate ? something like

ScriptAssert.signupBean.$1=EMAIL...

ScriptAssert.signupBean.$2=PASSWORD.....

I tried to play with alias , with no success. ( using Spring MVC )

Thanks


I'm not sure I understood your problem entirely, but if you want to show custom localized validator messages, everything you have to do is to put ValidationMessages.properties file at the root of your jar, change your code slightly

@ScriptAssert.List({
@ScriptAssert(lang="javascript",script="_this.email.equals(_this.confirmEmail)",message="{email.match.error}"),
@ScriptAssert(lang="javascript",script="_this.password.equals(_this.confirmPassword)",  message="{password.match.error}")

and put appropriate lines in your ValidationMessages.properties file

mail.match.error=Email and email confirmation does not match
password.match.error=Password and password confirmation does not match

That's it. Hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜