我正在使用 开发应用程序Grails 3.3.10
,我正在尝试创建一个下拉列表,但我将其变为空我将值放入application.yml
文件中,下面是我的代码。
应用程序.yml:
profile:
accType: ['supplier', 'buyer', 'both']
领域:
class Profile {
String accType
static constraints = {
accType(nullable: true, InList: Holders.config.getProperty('profile.accType'))
}
}
_form.gsp
<g:select required="" style="width:auto;" class="form-control input" name="accType" from="${Profile.constrainedProperties.accType.inList}" value="${profileInstance?.accType}" valueMessagePrefix="profile.accType"/>