On Tue, 2008-03-25 at 08:32 -0700, mjovanov wrote:
> There is a radio button and a text box on a page. The radio button
> controls whether the text box is rendered or not. There is also a
> Reset button, which I have coded to simply remove the backing bean
> from the session scope thus forcing the constructor to be called
> (which then loads data from the database). If, however, the value for
> the radio button from the database calls for the text box to be
> rendered, I find that the text box is indeed rendered but without any
> contents, even though there is some in the database. I am guessing
> this is because JSF after each phase checks whether a component is to
> be rendered or not and, if it’s not, it then removes all its queued
> events; as a result, the getter for the value bind to the text box is
> not called. I wish JSF would not do this…can anyone suggest an elegant
> solution to this problem? I am using MyFaces 1.1.4 and Tomahawk
> 1.1.3. 

I don't think your analysis is quite right. Queued events can affect the
update-model and apply-request-values parts of the lifecycle, but I
cannot think of any events that affect the rendering phase.

During the render phase, components like h:inputText do:
* if this component has a "submitted value" that was provided during the
form post, but the update-model did not run, then re-display that
"submitted value"
* else evaluate the value expression to fetch a value from the model.

So I suspect what has happened is that you are bypassing the
apply-values phase for the text box, and so rendering the cached value
(a blank string). You aren't using "immediate" anywhere are you?

And anyway, if you are deleting the backing bean in an action-listener
attached to your button (ie during the invoke-application phase) then
how is the state of your radio-button being passed through to the
rendered attribute of the textbox?

Regards,
Simon
  
    
> 
> ______________________________________________________________________
> View this message in context: JSF Lifecycle Question
> Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to