【发布时间】:2012-09-24 11:06:25
【问题描述】:
我想知道如何在 Richfaces 日历中设置默认日历以外的日期。
我想要这个,因为时区开始播放,如果应该使用服务器的时区之外的另一个时区,它可能是日历中选择的另一个“今天”。
谢谢。
【问题讨论】:
我想知道如何在 Richfaces 日历中设置默认日历以外的日期。
我想要这个,因为时区开始播放,如果应该使用服务器的时区之外的另一个时区,它可能是日历中选择的另一个“今天”。
谢谢。
【问题讨论】:
试试defaultTime属性
http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_calendar.html
“defaultTime”属性在两种情况下设置当前日期的默认时间值:
【讨论】:
另一种方法是从后端管理“今天”。
如果您有一个获取正确时间的支持 bean,您可以将 rich:calendar 值绑定到支持 bean 的 Date 属性。
支持 bean
Class MyBackingBean{
SomeUtil someUtil;
Date today;
@Create
public void init(){
today = someUtil.getCurrentTime();
}
public Date getToday(){ return today;}
}
HTML
<rich:calendar
id="todayDate"
value="#{myBackingBean.today}"></rich:calendar>
【讨论】: