I have a form in a view which performs ajax partial processing for autocompletion and gmap localization. My backing bean instantiates an entity object \"Address\" and is to
As BalusC explained, you can also add a reusable listener that cleans all input values, for instance:
public class CleanLocalValuesListener implements ActionListener {
@Override
public void processAction(ActionEvent actionEvent) throws AbortProcessingException {
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot viewRoot = context.getViewRoot();
List children = viewRoot.getChildren();
resetInputValues(children);
}
private void resetInputValues(List children) {
for (UIComponent component : children) {
if (component.getChildCount() > 0) {
resetInputValues(component.getChildren());
} else {
if (component instanceof EditableValueHolder) {
EditableValueHolder input = (EditableValueHolder) component;
input.resetValue();
}
}
}
}
}
And use it whenever you need to clean your local values: