I have a problem with selectInputDate:
I have a backing bean which I am binding to the selectInputDate. I have a menu which, when the menu changes, I set the date to now to the same property the selectInputDate is bound to.
For some reason, the date changes correctly, but the selectInputDate then calls a set and overrides the value with the old value…
Any idea why selectInputDate would call the setter?
<ice:selectInputDate popupDateFormat="dd-MMM-yyyy" renderAsPopup="true" value="#{dateContoller.date}"/>
<ice:selectOneMenu value="#{dateContoller.dateRange}" valueChangeListener="#{dateRangeDateContoller.dateRangeChanged}" >
....
</ice:selectOneMenu>
(dateRangeChanged sets the current date to now)
The
valueChangeListeneris intend to run some code logic whenever the newly submitted value differs from the original value. But you’re apparently actually not interested in the change of the value, you’re actually interested in resetting the submitted value.Just get rid of the
valueChangeListenerand do your thing in the bean’s action method.If that is not an option for some reason, then you need to elaborate more about the problem for which you thought that using a
valueChangeListeneris the right solution. There may be workarounds to keep thevalueChangeListeneranyway, such as callingFacesContext#renderResponse(), so that JSF won’t run theupdate model values(andinvoke action!) phases anymore, or usingValueChangeEvent#queue()to let it re-execute itself duringinvoke actionphase.To learn a bit more about the JSF lifecycle and when/why/how the one and other get called/invoked, you may find this practical article useful.