This has nothing to do with the phaseListener - and in fact,
you should not be referring to the trinidadinternal listener in
your faces-config.xml. (It's automatically registered, so you're
double-registering it.)
The issue is that there's a pending "local value" for each
component when Update Model runs. That local value
is still pending when setMasterSelectedValue() is called,
and will be pushed in.
To work around this, call resetValue() on the child
CoreSelectOneChoice in your updateComboBoxes() code.
-- Adam
On 6/7/07, Stéphane Poirier <[EMAIL PROTECTED]> wrote:
Hi,
I have a problem synchronizing my data with the visual result. I want to
implement 2 dependent comboBoxes (tr:selectOneChoice) using partialTriggers.
The components get their value from respective variables of a backingBean.
The problem is that when changing the master combo (which updates the child
combo when is Setter is called), the child combo refreshes but tries to
select the item it was supposed to select the time before. I noticed that
the master combo's Setter is called after the child combo's 1st Getter (so
this 1st getter has unsynchronized data).
Anyone knows what's going on and how to solve this? This sounds like a
PhaseListener issue or a bad use of the technology. Thanks in advance!
Here's some code:
JSP Code:
<tr:selectOneChoice value="#{
Bean.masterSelectedValue}" autoSubmit="true" id="master">
<f:selectItems value="#{ Bean.masterList}" />
</tr:selectOneChoice>
<tr:selectOneChoice value="#{
Bean.childSelectedValue}" partialTriggers="master">
<f:selectItems value="#{Bean.childList}" />
</tr:selectOneChoice>
Bean Code :
private ArrayList<SelectItem> masterList;
private Object masterSelectedValue;
private ArrayList<SelectItem> childList;
private Object childSelectedValue;
...
public void setMasterSelectedValue(Object value) throws Exception
{
this.masterSelectedValue = value;
updateComboBoxes(); //Code that updates the child combobox value
and selected item
}
Faces-config listener
<lifecycle>
<phase-listener>
org.apache.myfaces.trinidadinternal.context.TrinidadPhaseListener
</phase-listener>
</lifecycle>