>From: "Manfred K." <[EMAIL PROTECTED]> 
>
> 
> Hi Gary, 
> 
> thank you very much for your great answer. I already tried to access the 
> rendered HTML content in a custom ViewHandler. In a similar way as the 
> ClayViewHandler does it and the "recursiveRender" method was exactly what I 
> was looking for. Unfortunately there is still one problem remaining: 
> 
> *) On the first jsf request the RestoreViewExecutor calls 
> viewHandler.restoreView() which of course returns null for the UIViewRoot 
> 
> *) Then it gets created with viewHandler.createView(), but the _childrenList 
> of UIViewRoot is null 
> 

That's normal behavior for JSF 1.1.


> *) At the end of viewHandler.renderView() the list is still null - only 
> after externalContext.dispatch() is called, the _childrenList is populated 
> with the components of the UIViewRoot. This I think is too late to access 
> the rendered HTML content, because I have to modify it before it is 
> forwarded to client. 
> 

If you are using JSF 1.1 runtime, the rendering is invoked by the JSP tags.  
The JSF tags invoke the encode methods on the component.  The latest version of 
JSF (1.2) first creates the component tree and then invokes rendering.  The JSP 
tags only create the tree and the tree is rendered using a encodeAll method on 
the view root by the lifecycle.

The Clay example is in between the two JSF versions - implemented prior to JSF 
1.2 was drafted.  It doesn't use JSP to build the view.  If you want JSP to 
build your view, you will need to dispatch to the JSP after you have replaced 
the response writer with your own.  In your custom view handler, I would try 
overriding the renderView method while delegating to the original for the other 
methods.  In the renderView, pipe the response writer to a local buffer and use 
the external context to dispatch to the viewId (JSP page) [1].  Under JSF 1.1 
your response writer should be populated with the rendered markup.

[1]  
http://svn.apache.org/viewvc/myfaces/core/branches/1_1_5/impl/src/main/java/org/apache/myfaces/application/jsp/JspViewHandlerImpl.java?view=markup


> How can I handle this problem? Thanks in advance! 
> Regards 

Gary

> -- 
> View this message in context: 
> http://www.nabble.com/Custom-UIViewRoot-tf4447158.html#a12756257 
> Sent from the MyFaces - Users mailing list archive at Nabble.com. 
> 

Reply via email to