I would like to set dynamic Date values to the Map<String,Object>
and display that in the UI. I am working on JSF2. Here is my code
private Map<String, Object> selectDates;
{
selectDates = new LinkedHashMap<String, Object>();
selectDates.put("First Date", "111"); //label, value
selectDates.put("Second Date", "222");
}
public Map<String, Object> getSelectDates()
{
return selectDates;
}
I am having a drop down with label "First Date" and "Second Date" , now i have to assign values to these key dynamically. It does not work if i give as below:
private Date exDate;
private Date frontDate;
private Map<String, Object> selectDates;
{
selectDates = new LinkedHashMap<String, Object>();
selectDates.put("First Date", exDate;); //label, value
selectDates.put("Second Date", frontDate;);
}
public Map<String, Object> getSelectDates() {
return selectDates;
}
I tried using private Map<String, Date> selectDates;
but this does not give me value, it gives me null
.