Burak Akdeniz
Burak Akdeniz

Reputation: 35

rich:calendar set default date to today's date

I have an entity class and have a date variable inside the class which is filled by <rich:calendar> in JSF page. I want to see the today's date by default, when the JSF page is loaded. How can I do that?

Here is my code.

<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;
}

Upvotes: 0

Views: 1866

Answers (1)

BalusC
BalusC

Reputation: 1108732

Just preset the model behind the value attribute to the desired value.

E.g. directly after preparing/obtaining the instance:

instance.setNotificationDate(new Date());

Upvotes: 1

Related Questions