grails/gorm消息包
请帮我做这件事。这次我会说得更具体一些,因为我已经得到了一份这份工作的答复,我无法让这份工作发挥作用。我有一门课:grails/gorm消息包,grails,message,bundle,gorm,Grails,Message,Bundle,Gorm,请帮我做这件事。这次我会说得更具体一些,因为我已经得到了一份这份工作的答复,我无法让这份工作发挥作用。我有一门课: package aa1 class City { String name static constraints = { name(blank: false, nullable:false, unique: true, matches:"[a-zA-z ]+") } String toString(){ name
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]+]
我不能让它工作。请告诉我是否有任何自定义错误语法列表,以帮助我在web上使用。试试看
aa1.City.name.matches.invalid=the message
3.我不知道为什么。。它应该会起作用。“其他消息有效,而这条消息无效。”约翰我更新了我的答案。在你的另一个问题中,我的答案是不正确的。“你应该去掉复选标记。”约翰,我修正了另一个答案;但你可能应该删除这个或那个问题。我所做的一切都有用吗?现在应该可以了。好的,这一个已经确认,并且正在工作,所以解决了。非常感谢你