Hi,

a small example with two input fields, both with valueChangeListener and a f:ajax for rerendering the output field:

<h:form id="myForm">
       <h:outputLabel for="val1" value="Value1"/>
       <h:inputText id="val1"
                    value="#{myBean.val1}"
                    valueChangeListener="#{myBean.val1ChangedListener}">
           <f:ajax render="myText" event="change" />
       </h:inputText>

       <h:outputLabel for="val2" value="Value2"/>
       <h:inputText id="val2"
                    value="#{myBean.val2}"
                    valueChangeListener="#{myBean.val2ChangedListener}">
           <f:ajax render="myText" event="change" />
       </h:inputText>

       <h:outputText id="myText" value="#{myBean.val1} #{myBean.val2}"/>
   </h:form>

Everything works fine, until my Bean is ViewScoped. Every time I change a value in the input fields, this value is rendered in my output. But all changes before are lost.
E.g.
change value1 to "value1" causes output = "value1"
change value2 to "value2" causes output = "value2" (but it should be: "value1 value2")

I've debugged and found, that in restoreView always the first ViewState (which was active after entering the page) is restored. It looks like, the javax.faces.ViewState component in html DOM tree is not updated by an ajax request and so always the first ViewState is restored instead of the last.

I'm using the last MyFaces Snapshot (2.0.1-SNAPSHOT).

Does anyone has an idea? Or is something wrong in my code?

Thx for help.

Regards Marcus



Reply via email to