0

我正在使用日历 primefaces 3.5,我阅读了文档 并尝试使用 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)
 .....

所以,

我做错了什么?

如何解决?

4

1 回答 1

1

你有一个错字:“dataSelect”应该是“dateSelect”。

于 2013-09-06T21:29:06.677 回答