Simon Kitching wrote:
Paul Spencer schrieb:
I am dynamically adding child components to a form via the forms's
binding, <h:form .. binding="#{myBean.form}" />. My current challenge
is related to the valueChangeListner. Specifically the listener is
not called on the first change, but is called twice on the second
change. In addition the property being changed is updated in the
response as expected on both the first and second change.
1) Any ideas why I am seeing this behavior out of the listener?
Sorry, no idea.
2) Are their some issues/pointers/pitfalls I should be aware of when
dynamically adding child components to an existing bean?
(a) as for all bindings, don't hold onto the component reference for
more than request scope.
(b) you must explicitly set a (unique) id for each dynamically-created
component
If the ID is unique within the parent component, in this case a table,
is that sufficient?
If not is their a utility the will return a unique id?
I can't think of anything else.
You might find the FacesTrace library (facestrace.sourceforge.net)
useful. It can display the current component tree so you can check
whether your dynamic components have been added as you expect.
I will look into this.
Cheers, Simon
Paul Spencer