我有以下组合框:的Grails G:选择没有选择
<g:select name="ticketType" from="${app.domain.enums.TicketType?.values()}"
keys="${app.domain.enums.TicketType.values() }"
value="${ticketInstance?.ticketType}"
noSelection="${['null': 'Select One...']}"
/>
我设置以下约束的ticketType在命令对象
ticketType nullable: true, blank:true
TicketType是一个非常简单枚举:
public enum TicketType {
QUESTION, SUPPORT, MAINTENANCE, NEW_FUNCTIONALITY, MALFUNCTION
}
而且我每次没有在我的GSP中为ticketType设置一些值时,出现以下错误:
Failed to convert property value of type 'java.lang.String' to required type 'com.coming.enums.TicketPriority'
这就像在没有选择的情况下g:select设置“null”(字符串)的值。
我错过了什么?
请显示你的'g:select'的代码... – aiolos 2012-07-26 12:50:26
@aiolos对不起 - 格式化时出现了一些错误。我编辑了我的帖子。 – drago 2012-07-26 13:03:39