Smart Auto-PPR Change Event Policy

There is a common belief among ADF developers that setting the iterator binding change event policy to ppr  is not a good thing in terms of performance because this policy forces the framework to refresh all attribute bindings that are bound to this iterator on each request. That’s not true!

The framework refreshes only attributes that have been changed during the request and attributes that depend on the changed attributes.

Let’s consider a simple use-case. There is a form:

 
 
 
Screen Shot 2014-07-24 at 6.27.20 PM
The iterator’s change event policy is set to ppr, which is default in JDeveloper 11gR2 and 12c. The “First Name” and the “Last Name” fields are auto-submitted. The “Full Name” field is going to be calculated by concatenation of the first and last names. So, in the setters of the first and last names we have a corresponding method call:

public void setLastname(String value) {
  setAttributeInternal(LASTNAME, value);

  setFullname(getFirstname() + " " + getLastname());
}

Let’s have a look at the response content generated by the framework once the “Last Name” has been inputted:

Screen Shot 2014-07-26 at 6.49.05 PM

In response to the modified last name the framework is going to partially refresh only two input components – the last name and the full name. The full name is going to be refreshed because its value has been changed during the request. The rest of the components on the form don’t participate in the partial request.

Let’s consider a bit more complicated use case.

Screen Shot 2014-07-26 at 6.29.41 PM
We are going to show value of the “Title” field as a label of the “Full Name” field on the form:

<af:inputText label="#{bindings.Title.inputValue}"
              value="#{bindings.Fullname.inputValue}" 
              required="#{bindings.Fullname.hints.mandatory}"
              columns="#{bindings.Fullname.hints.displayWidth}"
              maximumLength="#{bindings.Fullname.hints.precision}"
              shortDesc="#{bindings.Fullname.hints.tooltip}" id="itFullName">
</af:inputText>

So, the label of the “Full Name” should be updated every time we make a selection of the title. For sure, the “Title” field is auto-submitted. And let’s have a look at the response content:

Screen Shot 2014-07-26 at 6.40.59 PM

Despite the value of the “Full Name” has not been changed during the request the input component is going to be refreshed because its label property points to the value of a changed field. And again only these two fields are going to be refreshed during the partial request.

That’s it!

Reference: Smart Auto-PPR Change Event Policy from our JCG partner Eugene Fedorenko at the ADF Practice blog.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


− one = 8



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close