grails/gorm 消息包
请帮我解决这件事。这次我会更具体,因为我已经得到了一个答案,并且无法让它发挥作用。我有一堂课:
package aa1
class City {
String name
static constraints = {
name(blank: false, nullable:false, unique: true, matches:"[a-zA-z ]+")
}
String toString(){
name
}
}
我想为此制作一个定制的错误消息。为此,我在 messages.proprietis 中添加了(因为我不知道约束语法的类型是什么):
aa1.City.name.doesnt.match=Letters between a-z and spaces.
aa1.City.name.match=Letters between a-z and spaces.
aa1.City.name.matches=Letters between a-z and spaces.
我得到的错误消息是:
Property [username] of class [class trafficmanfinal.User] with value ["] does not match the required pattern [[a-zA-z0-9]+]
我无法让它工作。请告诉我是否有任何自定义错误语法列表可以在网络上为我提供帮助。
Please help me with this thing. I'll be more specific this time, because i have already got an ansfor for this and cudnt get this to work. I have a class:
package aa1
class City {
String name
static constraints = {
name(blank: false, nullable:false, unique: true, matches:"[a-zA-z ]+")
}
String toString(){
name
}
}
I want to make a customized error message for this. For that, i added in the messages.proprietis (because i didnt know what was the type of constraint syntax):
aa1.City.name.doesnt.match=Letters between a-z and spaces.
aa1.City.name.match=Letters between a-z and spaces.
aa1.City.name.matches=Letters between a-z and spaces.
All i get for the error message is:
Property [username] of class [class trafficmanfinal.User] with value ["] does not match the required pattern [[a-zA-z0-9]+]
I can't get this to work. And let me know if there is any list of customized error syntax to help me in the web.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
try