当前位置: 动力学知识库 > 问答 > 编程问答 >

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

}

网友答案:

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

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

instance.setNotificationDate(new Date());
分享给朋友:
您可能感兴趣的文章:
随机阅读: