rich:calendar将默认日期设置为今天的日期

时间:2015-01-12 13:06:19

标签: jsf richfaces

我有一个实体类,并且在类中有一个日期变量,在JSF页面中由<rich:calendar>填充。我想在加载JSF页面时默认看到今天的日期。我怎样才能做到这一点?

这是我的代码。

<rich:calendar 
        cellWidth="24px" 
        cellHeight="22px"
        datePattern="dd.MM.yyyy" 
        id="notificationDate" 
        inputClass="input"
        inputStyle="width:73%;"
        value="#{correspondenceHome.instance.notificationDate}">
</rich:calendar>
// notificationdate
@Temporal(TemporalType.DATE)
@Column(name = "NotificationDate", length = 0)
public Date getNotificationDate() {
    return notificationDate;
}

1 个答案:

答案 0 :(得分:1)

只需将value属性后面的模型预设为所需的值。

E.g。在准备/获得instance后直接

instance.setNotificationDate(new Date());
相关问题