On 5/2/06, 王曾wang_zeng <[EMAIL PROTECTED]> wrote:
Graig, that's very kind of you. Are these aproachs feasible,when the page is requested by an inital request? When an inital request arrives, the view restoring phase is skipped and JSF goes to the response rendering phase directly. Then there should be no component tree constructed at all ,when prerender() is called. I wonder how can we access the component when they have not been constructed?
Yes, both approaches work even in this scenario. In the first approach (component binding) the rules for creating the component tree the first time (which would occur during Render Response phase) are very specific -- *if* the component has a binding attribute, call the getter method, and *if* it returns a component, then use that instance in the tree instead of creating a new one. Thus, the component you have defined in your backing bean is the one that will be used. For the second approach, you do not actually care about which component instance is used -- what you care is that the bindings point at the data you want to manipulate. So, it works the first time or subsequent times as well, since the binding expressions point at your backing bean's properties. Craig --
Wang Zeng