I'm trying to update the values of the bean with a button, like a data preload mechanism, so then the form is updated with the new values. I've visited a bunch of questions about this but those solutions didn't work here.
form.xhtml example code
<p:outputLabel for="name" value="Your name" />
<p:inputText value="#{person.name}"
id="yourname">
</p:inputText>
There are other fields similar to that, asking the user to fill them in order to fill the backing bean with new data instead of the default values preloaded when the page was loaded. Everything is grouped inside a h:panelGrid container with id="grid". Everything is also inside a h:form.
There is a button which somehow modifies the backing bean attributes and tries to reload the form so the input fields have those values on them.
<p:commandButton id="preload" value="Preload Example Data"
actionListener="#{controller.preload}">
</p:commandButton>
And the bean and its method is the following one.
public class Controller implements Serializable {
private static final long serialVersionUID = 5754692548431690216L;
@ManagedProperty(value = "#{person}")
private Person person;
public void preload(ActionEvent event) {
this.person.setName(...);
(...)
System.out.print("[PRELOAD COMPLETED]"); // debug purposes
RequestContext.getCurrentInstance().update("grid");
}