How to decrease request payload of p:ajax during e.g. p:dataTable pagination

Indeed, when you submit a form in HTML, by default every single HTML input element will be sent as request parameter. PrimeFaces ajax components therefore offer the partialSubmit="true" attribute which will then send only the HTML input elements covered by the process attribute, which defaults in <p:ajax> to @this and in <p:commandXxx> to @form.

So, just add this to the data table in case to optimize pagination performance:

<p:ajax event="page" partialSubmit="true" />

And add this to any command button which only needs to access the current row in the data table (e.g. to show it in a dialog) to optimize action processing performance:

<p:commandButton ... process="@this" partialSubmit="true" />

You can also configure it globally via below context param in web.xml:

<context-param>
    <param-name>primefaces.SUBMIT</param-name>
    <param-value>partial</param-value>
</context-param>

And then for cases where you actually need a full submit, explicitly use partialSubmit="false".

Leave a Comment