<p:ajax>事件:日历Primefaces 3.5 </p:ajax>不支持dataSelect

时间:2013-09-06 20:46:12

标签: java ajax jsf jsf-2 primefaces

我正在使用日历表面3.5并阅读documentation 并尝试使用ajax事件,但不起作用。

这是view.xhtml的代码

<p:calendar id="calendario-inicio" disabled="#{estadisticoConsultaController.desactivarCalendario}" value="#{estadisticoConsultaController.fechaInicioSeleccionada}" pattern="yyy-MM-dd" navigator="true" yearRange="c-70:c+10">
    <p:ajax event="dataSelect"   update="mensajesCalendario"/> 
</p:calendar>

这是bean的代码:

@ManagedBean
@ViewScoped
public class EstadisticoConsultaController   extends AbstractCtrl implements Serializable
{

    private Date fechaInicioSeleccionada ;

    private boolean desactivarCalendario =  Boolean.FALSE;

    @PostConstruct
    private void init (){  
        Calendar c = Calendar.getInstance();
        c.add(Calendar.MONTH, -2);

        //first day of the month
        int primerDiaMes =  c.getActualMinimum(Calendar.DAY_OF_MONTH);
        //lasted day of the month
        int ulitimoDiaMes =  c.getActualMaximum(Calendar.DAY_OF_MONTH);
        //current month
        int mes = c.get(Calendar.MONTH);
        //current year
        int ano = c.get(Calendar.YEAR);
        GregorianCalendar calendario = new GregorianCalendar(ano,mes,primerDiaMes );
        this.fechaInicioSeleccionada = calendario.getTime();
    }

    public void controladorFechaInicio(SelectEvent event){
         this.fechaInicioSeleccionada = (Date) event.getObject();
         ....
    }
    //getter's and setter's  ... 
}

当我尝试运行应用程序时,请获取下一条消息:

@34,96 <p:ajax> Event:dataSelect is not supported.

和堆栈Trece:

 ....
 Event:dataSelect is not supported.
at   org.primefaces.component.behavior.ajax.AjaxBehaviorHandler.applyAttachedObject(AjaxBehaviorHandler.java:149)
at org.primefaces.component.behavior.ajax.AjaxBehaviorHandler.apply(AjaxBehaviorHandler.java:127)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:190)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:190)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
 .....

所以,

我做错了什么?

如何解决?

1 个答案:

答案 0 :(得分:1)

你有一个拼写错误:“dataSelect”应该是“dateSelect”。