You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matt Tyson <ma...@gmail.com> on 2006/12/12 20:25:18 UTC

State saving and custom component

Here's my setup...

1) Request comes in and the component is rendered as normal

2) Next request is a AJAX request.  I grab the request in a listener during
restoreView, and get the component using its clientId (we're in the
afterPhase method).  Then I manually call the the encode methods on the
component.  This has 2 advantages: all the component attributes are
available and there's no threading to worry about in the listener.

3) Problem:  After the first postback response, I've missed some state
saving part, so the component clientId is NOT in the viewRoot ... in fact
the viewRoot has no chldren.  (If I make another request, it works again,
because its handled as a new request and the component tree is generated).

Question: What do I need to manually do here in the afterPhase of the
renderView to make the component available to the next request.  (I am using
client side state).

Thanks very much.

-- 
View this message in context: http://www.nabble.com/State-saving-and-custom-component-tf2809629.html#a7839802
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: State saving and custom component

Posted by Matt Tyson <ma...@gmail.com>.
I always enjoy answering my own questions moments after posting them.

Here's the missing piece I needed for others:

context.getApplication().getStateManager().saveSerializedView(context);

Regards.


Matt Tyson wrote:
> 
> Here's my setup...
> 
> 1) Request comes in and the component is rendered as normal
> 
> 2) Next request is a AJAX request.  I grab the request in a listener
> during restoreView, and get the component using its clientId (we're in the
> afterPhase method).  Then I manually call the the encode methods on the
> component.  This has 2 advantages: all the component attributes are
> available and there's no threading to worry about in the listener.
> 
> 3) Problem:  After the first postback response, I've missed some state
> saving part, so the component clientId is NOT in the viewRoot ... in fact
> the viewRoot has no chldren.  (If I make another request, it works again,
> because its handled as a new request and the component tree is generated).
> 
> Question: What do I need to manually do here in the afterPhase of the
> renderView to make the component available to the next request.  (I am
> using client side state).
> 
> Thanks very much.
> 
> 

-- 
View this message in context: http://www.nabble.com/State-saving-and-custom-component-tf2809629.html#a7839899
Sent from the MyFaces - Users mailing list archive at Nabble.com.