【发布时间】:2013-08-01 06:56:58
【问题描述】:
使用时区创建客户时,timeZone 具有价值。当我显示 timeZone 时,我想显示选定的选项。
例如,我想显示 SST,萨摩亚标准时间 -11:0.0(Selected Option) 而不是 Pacific/Midway(Value)。
我必须在显示页面中更改此功能的哪些内容?
类客户{
static constraints = {
}
String name
String timeZone
}
在create.gsp中:
<div class="fieldcontain ${hasErrors(bean: customerInstance, field: 'timeZone', 'error')} ">
<label for="timeZone">
<g:message code="customer.timeZone.label" default="timeZone" />
</label>
<g:if test="${customerInstance?.timeZone}">
<g:timeZoneSelect name="timeZone" value="${TimeZone.getTimeZone(customerInstance?.timeZone)}" />
</g:if>
<g:else>
<g:timeZoneSelect name="timeZone" value="${customerInstance?.timeZone}" />
</g:else>
</div>
在 show.gsp 中:
<span class="property-value" aria-labelledby="timeZone-label"><g:fieldValue bean="${customerInstance}" field="timeZone"/></span>
【问题讨论】: