Value Change listener not working in primefaces calendar

前端 未结 6 2222
执笔经年
执笔经年 2021-01-03 22:30

I am using primefaces 3.2 and JSF 2.0

My scenario is I have file date, last date and next date in my form. When user enters file date I need to update file date valu

6条回答
  •  心在旅途
    2021-01-03 23:04

    In more recent versions of PrimeFaces, SelectEvent should be usedsee the following code snippet

    
        
    
    
    public void onDateSelect(SelectEvent event) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
        facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Date Selected", format.format(event.getObject())));
    }
    

    In older primefaces versions use DateSelectEvent

    
    
    public void dateChange(DateSelectEvent event) {
        Date date = event.getDate();
        System.out.println("File Date: " + date);
        System.out.println("Hello... I am in DateChange");
    }
    

提交回复
热议问题