誰かが複数の値を取得する方法を教えてもらえますか
<g:select multiple="multiple" ...
create.gspにこれがあります
<g:select name="validator.id" multiple="multiple" optionKey="id" from="${com.project.Validator.list()}" value="${validators}" />
これはOperationLogContoller.groovyにあります
def create = {
def operationLogInstance = new OperationLog()
operationLogInstance.properties = params
operationLogInstance.validator = Validator.get(params.validatorId)
operationLogInstance.operation = Operation.get(params.operationId)
return [operationLogInstance: operationLogInstance]
}
def save = {
def operationLogInstance = new OperationLog(params)
println(params.validator)
operationLogInstance.validator = Validator.get(params.validator.id);
if (operationLogInstance.save(flush: true))
flash.message = "${message(code: 'default.created.message', args: [message(code: 'operationLog.label', default: 'OperationLog'), operationLogInstance.id])}"
}
selectから1つだけを選択すると完全に機能しますが、2つを選択すると、次の例外が発生します。
groovy.lang.MissingMethodException: No signature of method: com.akent.Validator.get() is applicable for argument types: (java.lang.String, java.lang.String) values: [3, 4]
Possible solutions: get(java.lang.Object), getId(), getIp(), getAt(java.lang.String), getAll(), ident()