Skip to main content

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.
Unfortunately this didn't help me out. Also, noticed the following warning message in the server console at runtime.$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.


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

The 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 parameter. In this case both auto generated IDs and explicitly set IDs would get suppressed


Anonymous said…
Thanks, you help me a lot.
I had the same problem !
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.

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.

Asisranjan Nayak

Popular posts from this blog

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…