简体   繁体   中英

RichFaces rich:calendar value is one step behind

richfaces noob here. Im using RichFaces 4.1. and JSF 2.1 in a web app I'm building

Within my .xhtml i have defined a rich:calendar component like this:

<h:outputLabel value="#{bundle.CreateSolicitudesLabel_fechafinal}" for="fechafinal" />
                <rich:calendar locale="es_MX" id="fechafinal" valueChangeListener="#{solicitudesBean.fechaValueChangeListener(event)}" value="#{solicitudesBean.solicitud.fechafinal}" datePattern="dd/MM/yyyy" required="true" requiredMessage="#{bundle.CreateSolicitudesRequiredMessage_fechafinal}">
                    <a4j:ajax/>
                </rich:calendar>

And my backing bean:

public void fechaValueChangeListener(ValueChangeEvent event)

{



System.out.println("FECHA FINAL"+solicitud.getFechafinal());

}

The problem is that the date value is not set the first time i select a date on the calendar and it will print out a null. On the following attempts, the date value will always be one step behind the currently selected value.

What am i doing wrong?

I have also tried with event.getNewValue() but I always get a null value:

public void fechaValueChangeListener(ValueChangeEvent event){

     System.out.println("FECHA FINAL"+ event.getNewValue());

}

Thanks for your help

What happens if you change it like this:

<h:outputLabel id="output" value="#{bundle.CreateSolicitudesLabel_fechafinal}" for="fechafinal" />
<rich:calendar id="fechafinal" value="#{solicitudesBean.solicitud.fechafinal}">
    <a4j:ajax event="change" execute="fechafinal" render="output"/>
</rich:calendar>

I've never used calender so I could be completely wrong. Sorry for the noise in that case...

MAG, Milo van der Zee

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM