AutoUpdate is a utility tag, which registers the attached/parent component to be updated automatically on each ajax request. All ajaxified components (includes p:ajax) provides an attribute, to mark the current request to ignore all autoUpdates.
<div class="card">
<h:form>
<p:outputPanel styleClass="mb-3">
<p:autoUpdate/>
Time: #{autoUpdateView.time}
</p:outputPanel>
<p:commandButton value="AJAX request" update="@none" process="@this" styleClass="mr-2" />
<p:commandButton value="Ignore AutoUpdate" update="@none" process="@this" ignoreAutoUpdate="true"/>
</h:form>
</div>
package org.primefaces.showcase.view.misc;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Named;
import java.text.SimpleDateFormat;
import java.util.Date;
import io.quarkus.runtime.annotations.RegisterForReflection;
@Named
@RequestScoped
@RegisterForReflection(serialization = true)
public class AutoUpdateView {
private String time;
@PostConstruct
public void init() {
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
time = sdfDate.format(now);
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}