gpt4 book ai didi

exception - 我无法将验证消息设置为约束

转载 作者:行者123 更新时间:2023-12-02 03:30:17 26 4
gpt4 key购买 nike

我在设置约束消息时遇到了一些问题。显然,grails 无法绑定(bind)消息。当我显示我收到的错误验证消息时:

  • Field error in object 'br.com.tokenlab.pemaap.IndividualPerson' on field 'alternativeDoc': rejected value [Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus purus non erat tempus dictum. Nunc cursus tellus sed fermentum laoreet. Pellentesque vel ante dapibus, ullamcorper nisl id, rutrum ante. Etiam ex libero, aliquam consectetur orci aliquam.]; codes [br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc.size.error.br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc,br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc.size.error.alternativeDoc,br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc.size.error.java.lang.String,br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc.size.error,individualPerson.alternativeDoc.size.error.br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc,individualPerson.alternativeDoc.size.error.alternativeDoc,individualPerson.alternativeDoc.size.error.java.lang.String,individualPerson.alternativeDoc.size.error,br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc.size.toobig.br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc,br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc.size.toobig.alternativeDoc,br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc.size.toobig.java.lang.String,br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc.size.toobig,individualPerson.alternativeDoc.size.toobig.br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc,individualPerson.alternativeDoc.size.toobig.alternativeDoc,individualPerson.alternativeDoc.size.toobig.java.lang.String,individualPerson.alternativeDoc.size.toobig,size.toobig.br.com.tokenlab.pemaap.IndividualPerson.alternativeDoc,size.toobig.alternativeDoc,size.toobig.java.lang.String,size.toobig]; arguments [alternativeDoc,class br.com.tokenlab.pemaap.IndividualPerson,Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rhoncus purus non erat tempus dictum. Nunc cursus tellus sed fermentum laoreet. Pellentesque vel ante dapibus, ullamcorper nisl id, rutrum ante. Etiam ex libero, aliquam consectetur orci aliquam.,1,255]; default message [Property [{0}] of class [{1}] with value [{2}] does not fall within the valid size range from [{3}] to [{4}]]

Soo,输入数据以调用此异常意向性。我的问题是将这个最糟糕的错误消息替换为另一个。我的域约束代码:

static constraints = {
cpf unique: false, blank: true, nullable: true, size: 1..255
rg blank: true, nullable: true, size: 1..255
alternativeDoc blank: true, nullable: true, size: 1..255
nationalityType blank: true, nullable: true, inList: ["B", "E"]
photo blank: true, nullable: true
dateOfBirth blank: true, nullable: true
gender blank: true, nullable: true, inList: Holders.config.individualPerson.gender
nameOfFather size: 1..255
nameOfMother blank: true, nullable: true, size: 1..255

person blank: false, nullable: false
maritalStatus blank: true, nullable: true
race blank: true, nullable: true
cityOfBirth blank: true, nullable: true
countryOfBirth blank: true, nullable: true
}

还有我的 messages.properties:

  individualPerson.cpf.size.error=Número de caracaretes inválio para cpf.
individualPerson.cpf.blank=O cpf não pode estar em branco.
individualPerson.cpf.nullable=O cpf não pode estar em branco.
individualPerson.cpf.cpf=Cpf inválido.
not.cpf=Cpf inválido.
individualPerson.rg.size.error=Número de caracaretes inválio para rg.
individualPerson.alternativeDoc.size.error=O número do documento deve conter entre 1 á 255 caracteres.
individualPerson.nameOfFather.size.toobig=O nome para o Pai de conter de 1 á 255 caracteres.
individualPerson.nameOfFather.size.toosmall=O nome para o Pai de conter de 1 á 255 caracteres.
individualPerson.nameOfMother.size.error=O nome para a Mãe de conter de 1 á 255 caracteres.
individualPerson.person.displayName.error=O nome para exibição de possuir entre 1 e 255 caracteres.

person.name.size.error=O nome da pessoa de possuir entre 1 e 255 caracteres.
person.displayName.size.error=O nome para exibição de possuir entre 1 e 255 caracteres.

最佳答案

您将“alternativeDoc”字段设置为 MAX SIZE 255。您尝试插入更多字符。

关于exception - 我无法将验证消息设置为约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27299073/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com