问题描述:

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;

}

网友答案:

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

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

instance.setNotificationDate(new Date());
相关阅读:
Top