Programmatic PPR on af:outputText / af:outputFormatted

Partial page rendering (PPR) allows small areas of a page to be refreshed without the need to redraw the entire page. I had a scenario where an af:outputText component needs to be refreshed programmatically. The <af:outputText> tag looks like as ashown below.
 <af:outputText id="op1"  value="#{myBean.someValue}"  />

To PPR the outputText component, tried calling the following API from backing bean method.
AdfFacesContext.getCurrentInstance().addPartialTarget(outputTextComp);
Unfortunately this didn't help me out. Also, noticed the following warning message in the server console at runtime.
oracle.adfinternal.view.faces.renderkit.rich.PprResponseWriter$PPRTag finish
WARNING: no PPR-capable ID found for elements of: RichOutputText[UIXFacesBeanImpl, id=op1]
Further investigation on the above issue revealed some interesting points. Let me try summarizing them below.

Why does Programmatic PPR fail for <af:outputText>?

In an attempt to reduce content size of the web page, framework tries optimize the handling of auto-generated ids for af:outputText / af:outputFormatted components. This mean that, id will be generated only if it's really required by the client. The same 'id suppression' optimization is applicable even if you have id set explicitly for the component. One scenario where the id required at client side is during the partial page rendering of components. So adding the outputText as a 'partial target' declaratively will result in client side id generation. But in the above use case outputText needs to be updated programmatically, so there doesn't exist any explicit partialTriggers set declaratively.

Solution

Having said that, however there exist two possible solutions to work around this scenario.
1. Set clientComponent="true" for af:outputText which would generate the required client side id.
 <af:outputText id="op1" clientComponent="true" value="#{myBean.someValue}"  />

2. Disable 'id suppression' optimization at application level by adding the following context parameter in web.xml
<context-param>
<param-name>
oracle.adf.view.rich.SUPPRESS_IDS
</param-name>
<param-value>auto</param-value>
</context-param>

The oracle.adf.view.rich.SUPPRESS_IDS parameter can take two values
auto : Components can suppress auto generated IDs, but explicitly set ID needs to be honored.
explicit : This is the default value for oracle.adf.view.rich.SUPPRESS_IDS parameter. In this case both auto generated IDs and explicitly set IDs would get suppressed

Comments

Anonymous said…
Thanks, you help me a lot.
I had the same problem !
Yiannis
Sudipto Desmukh said…
Thanks Jobinesh... helped me a lot
Anonymous said…
Thanks, that was a nice tip.
Anonymous said…
seriously it saved lot of time
Anonymous said…
Thk a lot, this helped me a lot.
legned143 said…
hi Jobinash,

Thanks for your post. but I am not getting the output value whatever user entered. can you please suggest me what is the issue.
legned143 said…
hi Jobinash,

Thanks for your post. but I am not getting the output value whatever user entered. can you please suggest me what is the issue.
Hi

Searching data on user click to either commandImageLink or pressing enter key. If data is not found then the message "Data not found" should display which implemented using af:outputText.

If data is not found on click on commandImageLink then the message is displaying where as the message is not displaying on pressing enter key even though the text message is setting to af:outputText.

I have tried adding clientComponet to True to outpuTText, implementing partialTrigger.

Please help me out to resolve this issue.

Thanks
Asisranjan Nayak

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.