how to set currentdate as mindate in calendar component of primefaces?

jsf-2

Solution

Just bind it as a bean property the usual way.

<p:calendar ... mindate="#{bean.currentDate}" />

By the way, the way how you created the current date is clumsy. Just invoking the `Date`'s own constructor is sufficient. Using the `Calendar` for this purpose only brings unnecessary overhead along.

private Date currentDate = new Date();

public Date getCurrentDate() {
    return currentDate;
}

Problem

I am using calendar component of primefaces. I want to set `mindate=currentdate.` I want restrict user to select date before current date. I am using JSF2.0.

Original source